+ Reply to Thread
Results 1 to 4 of 4

Macro using Vlookup to select a range dynamically according to data

  1. #1
    Registered User
    Join Date
    11-03-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Macro using Vlookup to select a range dynamically according to data

    Hey guys,

    I'm new to this forum. I'm a beginner in VBA and have a problem I'm facing. I want to get stock prices from Book1 (Bhavcopy All) to Book2 (Final Scores) using vlookup. One column keeps getting added in Book 1, and I have to get that latest column into Book 2. When I was getting stuck with Object defined errors, I tried using record macro and getting some code. Now I've edited it to make the range dynamic, with the following code. The problem is in the vlookup function as I'm getting rng and LastColumn as text in the formula, instead of the actual numbers. Also I'm getting an error, Run time error '1004': Unable to get the VLookup property of the WorksheetFunction class. Any help would be appreciated.

    Please Login or Register  to view this content.
    Last edited by appuniru; 11-17-2016 at 03:02 AM. Reason: Forgot to mention an error.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Macro using Vlookup to select a range dynamically according to data

    code tags updated
    Last edited by protonLeah; 11-16-2016 at 03:46 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    11-03-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Re: Macro using Vlookup to select a range dynamically according to data

    Ya done it. Sorry about that

  4. #4
    Registered User
    Join Date
    11-03-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Re: Macro using Vlookup to select a range dynamically according to data

    In the Vlookup function, I tried replacing rng with "& s &" but the same error pops up.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel VBA 2013 Dynamically Select Data XY Scater Chart
    By B Eccles-Williams in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2014, 04:37 PM
  2. Dynamically select various worksheets to group into one PDF using data values
    By titanzrule32 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2014, 10:11 AM
  3. Macro to dynamically select and copy data from different sheets and columns
    By Gr8tDaze in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 07:32 PM
  4. Select range dynamically using relative row and column references
    By gtol in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2012, 06:43 AM
  5. Select Data Dynamically and then Sort
    By rvc81 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2010, 08:28 AM
  6. dynamically select a range of cells for use in a formula
    By isofuncurves in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2006, 09:40 PM
  7. Replies: 1
    Last Post: 07-28-2005, 02:06 PM

Tags for this Thread

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