+ Reply to Thread
Results 1 to 3 of 3

VBA - VLookup on different sheet

  1. #1
    Registered User
    Join Date
    04-21-2008
    Posts
    6

    VBA - VLookup on different sheet

    Hi,

    I'm fairly new to VBA and can't figure this out. I'm stepping through rows on sheet 1 and (along with many other things) using vlookup to grab a value from sheet 2 ("ShiftMaster"). When I hardcode a range variable like below, and use it in the vlookup function, all works fine:

    Please Login or Register  to view this content.
    Since the range may grow over time, I need to add a little smarts to allow for that. I did the below to determine the number of rows in the range

    Please Login or Register  to view this content.
    But, when I try to change from the hardcoded range above to one using "cells" so I can utilize the xRow var (like below), I continually get a 1004 - application defined object error

    Please Login or Register  to view this content.
    I've looked at other approaches to allow for a dyanmic range, but I error out on them as well

    Any input would be appreciated!

    Thanks,
    David

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    David

    Try something like

    Please Login or Register  to view this content.
    HTH

    rylo

  3. #3
    Registered User
    Join Date
    04-21-2008
    Posts
    6
    Rylo - thanks!! That works great. I'll do a little digging to understand the difference in the two approaches.

    Thanks again

+ 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