+ Reply to Thread
Results 1 to 11 of 11

Unlimited Range for VlookUp in Macro Code

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Exclamation Unlimited Range for VlookUp in Macro Code

    I am trying to program a Vlookup for Column C, however the macro will be used for more than one report. Can anyone show me how to program the range to be unlimited? When I put C655636 (the max amount of rows for Excel 2003), Excel freezes and will not respond. This is one part of a very large macro but I can not continue until this is solved.

    Your help is appreciated!

    Thanks!

    Please Login or Register  to view this content.
    Last edited by fmfernandez11; 01-11-2013 at 11:16 AM.

  2. #2
    Forum Contributor
    Join Date
    01-09-2009
    Location
    Cedar Hill, Tx
    MS-Off Ver
    Excel 2003
    Posts
    200

    Re: Unlimited Range for VlookUp in Macro Code

    Howdy:

    Do you think that the problem may be memory-related with a range that large?

    When I have that type of thing to do, I only copy the formula into the rows that actually need it. If only 200 cells have data, for instance, the range would be modified to read "range("c2:c200")". Partial prototype code is as follows:

    Please Login or Register  to view this content.
    HTH.

    Bob

  3. #3
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Unlimited Range for VlookUp in Macro Code

    Thanks for your help. I tried using it the first option and I have the Vlookup formula in one cell and I am trying to drag the formula down to the rest of the cells. That number of cells is undefined. Any ideas?

  4. #4
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Unlimited Range for VlookUp in Macro Code

    Please Login or Register  to view this content.
    Last edited by fmfernandez11; 01-11-2013 at 11:14 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Unlimited Range for VlookUp in Macro Code

    upload a sample file

  6. #6
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Unlimited Range for VlookUp in Macro Code

    The error message appears in the
    Please Login or Register  to view this content.
    I have changed the range to "C2:C" and I have also changed the formulas to the ones given above by bstubbs. I recently tried this as well :

    Please Login or Register  to view this content.
    but it did not work. Im in a desperate need of help.
    Last edited by fmfernandez11; 01-11-2013 at 11:15 AM.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Unlimited Range for VlookUp in Macro Code

    We would love to continue to help you with your query, but first, before we can proceed, please see Forum Rule #3 about code tags and adjust accordingly...
    HTH
    Regards, Jeff

  8. #8
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Unlimited Range for VlookUp in Macro Code

    I have adjusted according to the rules.

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Re: Unlimited Range for VlookUp in Macro Code

    Try this: The LastRow can be either the lastrow used in a particular column, OR it can be the last row used in your spreadsheet (but only one; you'll need to delete the line you DON'T want to use). After determining your LastRow, the VLookup is inserted in each cell in column C beginning with C2 to C and your LastRow.
    Please Login or Register  to view this content.
    Last edited by jomili; 01-16-2013 at 09:48 AM.

  10. #10
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Unlimited Range for VlookUp in Macro Code

    Thank you so much! It worked greated.

    I really appreciate it.

  11. #11
    Registered User
    Join Date
    01-16-2013
    Location
    Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Unlimited Range for VlookUp in Macro Code

    It is very useful! Thank you very much!

+ 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