+ Reply to Thread
Results 1 to 4 of 4

Look up in a different sheet in macro

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    Pakistan
    MS-Off Ver
    2016
    Posts
    95

    Look up in a different sheet in macro

    I want to look up in diffrent sheet.
    The current formula is as below


    Please Login or Register  to view this content.
    How do I apply this in macro/VBA

    macro needs to be applied in Sheet3.Cells(7,1)

    Lookup value is in Sheet1.Cells(Y,25)

    I have tried

    Please Login or Register  to view this content.
    but not successful.

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Look up in a different sheet in macro

    you said:
    but not successful
    so what happened? got an error? got #Name? in the cell? #NUM! in the cell?

    i assume you've read this?

    https://docs.microsoft.com/en-us/off...nction.vlookup

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Look up in a different sheet in macro

    This:

    Please Login or Register  to view this content.
    should be:
    Please Login or Register  to view this content.
    Rory

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Look up in a different sheet in macro

    If you are working with cells(r,c) you don't combine with cell references but row and column references.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    would not work,
    Since your range is wrong the code will error.
    Please Login or Register  to view this content.
    This is assuming Y is an actual integer.
    If it is supposed to be Column X like in your original formula, then it should be range("X3") or cells(3,"X") or cells(3,24)

+ 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] macro creates new sheet and names it, need to create hyperlink to new sheet on main sheet
    By cjburns in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2020, 11:26 AM
  2. [SOLVED] Macro updating after selecting another sheet and back to Macro enabled sheet?
    By Imran Magsi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-29-2016, 04:38 AM
  3. [SOLVED] Macro to copy data from a master sheet to separate sheet as per date using a macro
    By tmaster81 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2014, 08:05 AM
  4. Macro to gnereate new sheet which includes the macro to generate a new sheet
    By jocanon in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-27-2013, 05:15 PM
  5. [SOLVED] Macro running on active sheet instead of sheet defined in macro
    By davegscott in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 02:04 PM
  6. [SOLVED] Macro to Copy Data from one Sheet A to Sheet B based on value in cell on sheet A
    By scass in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 07:21 PM
  7. Replies: 1
    Last Post: 07-30-2012, 02:35 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