Results 1 to 3 of 3

Thread: how do we fill in school.xlsx file age column from age.xlsx file by using name column

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2019
    Posts
    54

    how do we fill in school.xlsx file age column from age.xlsx file by using name column

    *how do we fill in school.xlsx file age column from age.xlsx file by using name column with visual basic in excel? Tables have variable length and have more than 10000 rows.

    school.xlsx

    |A | B | C|
    |:---- |:------:| -----:|
    |name | code | age|
    |peter1 | 254 |
    |jane2 |153 |
    |ted | 323 |
    |peter3 |323 |

    age.xlsx
    |A |B|
    |:---- |:------:|
    |name |age|
    |mark3| 1,2|
    |peter1 | 5 |
    |jane2 | 1,5|

    '''



    Sub Insertdata()
    Dim iAge As Integer
    Set src = Workbooks.Open("age.xlsx", True, True)
    iAge = src.Worksheets("Sheet1").Range("B2").Value
    Worksheets("Sheet1").Range("C2").Value = iAge
    End Sub


    '''
    Now the program returns value 1 in field C2 in age.xlsx file.
    How do we remake the program to insert age data in right row in shcool.xlsx?

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: how do we fill in school.xlsx file age column from age.xlsx file by using name co

    Why in blazes VBA?
    That's a simple vlookup
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2019
    Posts
    54

    Re: how do we fill in school.xlsx file age column from age.xlsx file by using name co

    how can we use in vba this line
    =ЕСЛИОШИБКА(ВПР(A10;'D:\school\[age.xlsx]Sheet1'!$A$2:$C$26000;3;0);"Not found")
    and instead of Not found the value that do not change
    Last edited by daveramsey; Apr 27th, 2021 at 06:06 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width