+ Reply to Thread
Results 1 to 4 of 4

Vlookup contained within VBA code.

  1. #1
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    868

    Vlookup contained within VBA code.

    Good morning Happy Campers.

    I have experience with both VBA (basic) & Vlookups (good), but would like to know how to combine them.

    I get the vlookup & how it works (reference cell, data range, column # & the exact/near match)

    Please see attached
    SHEET1
    Range - A:F contains the range named 'Data' used in J:O
    Range - J:O contains the cells with Vlookup manually entered
    Range - Q:V contains the range where i would like VBA to do the calculation, and enter only the values from the result instead of the formula.

    SHEET2
    Range - A:F contains the range named 'Data1' used in J:O
    Range - J:O contains the cells with Vlookup manually entered
    Range - Q:V contains the range where i would like VBA to do the calculation, and enter only the values from the result instead of the formula.

    I would also like to know how to write the code so it would do the calculation on both sheets, upon calculating the results, it would enter the value only.
    Then, to build on that i would need to know how to get the code to ignore cells that contained information, and focus only on blank cells.
    Both sheets can potentially be hundreds of rows long.

    The reasoning behind my question is i have a very large workbook with thousands of rows across 5 tabs, and i would like to reduce the amount of calculations each time an entry is made, the answer to the above wont solve my issue, but will greatly improve my understanding of how to do it? (i may also be back with more questions lol)

    Kind Regards
    galvinpaddy
    Attached Files Attached Files

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Vlookup contained within VBA code.

    What about something like this in each worksheet module?

    Please Login or Register  to view this content.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    868

    Re: Vlookup contained within VBA code.

    Hi JapanDave,
    Having tested your code i find it works, however if i enter info into any cell it then runs the code and produces a Runtime error '91', (i also cant then delete that entry as i get the same error again.) the error message also reads Object variable not set, which highlights the line
    Please Login or Register  to view this content.
    in yellow.

    If possible, can you help me with understanding how to assign this code to a button instead of a change?

    regards.

  4. #4
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    868

    Re: Vlookup contained within VBA code.

    The button i can do, its just the coding i need support on.

+ 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