+ Reply to Thread
Results 1 to 8 of 8

VBA Vlook Up

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    VBA Vlook Up

    Hi!

    I have a workbook, where there is a master data in Sheet 1.

    I have to look up data from the Sheet 1 in Sheet 2.

    Here the only issue is, I already have some data in Sheet 2 Column B which I need to keep, and should not be deleted.

    I can do the same using Excel, however I want to know how to write a VBA code for the problem.

    Sample sheet attached!

    Can anyone guide me regarding the same?
    Cheers!
    Deep Dave

  2. #2
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA Vlook Up

    Use this file
    Attached Files Attached Files

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: VBA Vlook Up

    Hey!! Thank you for the reply.

    However, you have specified, "If i = 12 Then" which will not always be the case.

    It will keep on changing.

    The code will not work in that case.

    For example. I changed the row number of Part Number R9 (From Row 12 to Row 13), in which case the code failed..

  4. #4
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA Vlook Up

    Not a problem, working on this.....

  5. #5
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA Vlook Up

    Is it fine now
    Attached Files Attached Files

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: VBA Vlook Up

    Please Login or Register  to view this content.
    This is what I edited.. Is this correct?? It seems to be working!

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: VBA Vlook Up

    i added "LR = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row" as the last row may change..

  8. #8
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA Vlook Up

    Ya its right...you can run this macro without worrying about number of lines in Sheet 2....

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1