+ Reply to Thread
Results 1 to 2 of 2

Create Table ranges to use in Vlookup formula in vba

  1. #1
    Registered User
    Join Date
    03-27-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    56

    Create Table ranges to use in Vlookup formula in vba

    I am using vlookup formula using in vba as below in sheet 2

    samplerange.formula = "VLOOKUP(C1,Sheet!$A:$C,3,0)"

    i want to replace the column numbers mentioned in the above formula with named table range as below

    samplerange.formula = "VLOOKUP(C1, namedtablerange ,3,0)"
    where
    namedtablerange = Sheet!$A:$C

    first question: would it work if i mention namedtablerange in vlookup formula?
    second question: If yes, could some one please help me increating such table range which can be used in the vlookup. It should use the header values (like H1, H2, H3..) instead of column numbers (like $A:$C).

    Attached sheet shows two data sets A to C and N to O.
    Two table ranges are to be defined for these two sets.

    Thanks in advance for your help.
    Attached Files Attached Files
    Last edited by Sum; 06-29-2022 at 03:30 AM.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Create Table ranges to use in Vlookup formula in vba

    The following code will scan along row 1 looking for tables and add named ranges for them:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

+ 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. How to create expanding formula ranges in table ??
    By nhungthientai in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 02-15-2019, 03:25 PM
  2. VBA code to create a Pivot Table from different ranges
    By ba13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-26-2016, 07:58 PM
  3. [SOLVED] Create a Pivot Table from 3 Name Ranges
    By myobreportguru in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 07-21-2016, 08:28 PM
  4. How to create expanding formula ranges in table
    By chris01252 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 07-05-2015, 11:59 AM
  5. [SOLVED] Create code to update named ranges in a table. Table contains Many Name Ranges
    By Calio in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-09-2014, 11:13 AM
  6. Replies: 1
    Last Post: 05-12-2009, 03:40 PM

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