Results 1 to 2 of 2

Use column header in Range Formula for Vlookup vba

Threaded View

waffleboy Use column header in Range... 12-13-2023, 03:48 PM
alansidman Re: Use column header in... 12-13-2023, 04:33 PM
  1. #1
    Registered User
    Join Date
    02-11-2015
    Location
    Asia
    MS-Off Ver
    Office 2016
    Posts
    12

    Use column header in Range Formula for Vlookup vba

    hi I encounter an error that it is invalid in red. How do I correct the column header "Header 2nd Number (Dept Office)"?

    I'm using column header as this is a standard template.

    Sub FillRows()
    
    Dim last_row As Long
    last_row = Cells(Rows.Count, 2).End(xlUp).Row
    Range("A2").Formula = "=VLOOKUP([@[Header 2nd Number (Dept Office)],Sheet1!$A$1:$J$100,2,FALSE)"
    Range(A2").AutoFill Destination:=Range("A2:A" & last_row)
    
    End Sub

    In addition, how do I apply the same to all files in a folder?

    Hope to answer the first qns first.

    Thank you!
    Last edited by alansidman; 12-13-2023 at 04:32 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help with formula, find a name in range and recive column header
    By Masun in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-06-2020, 09:42 AM
  2. Define range by column header in formula
    By punno2015 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2019, 10:36 AM
  3. [SOLVED] VLOOKUP returns column where column header matches another cell
    By bridge4444 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 11:23 AM
  4. Replies: 0
    Last Post: 12-26-2013, 01:12 PM
  5. Replies: 1
    Last Post: 10-05-2013, 03:35 PM
  6. VLookUp column header
    By jn90z in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-06-2013, 04:20 PM
  7. First column of range in VLOOKUP contains formula
    By er.diljeetsingh in forum Excel General
    Replies: 3
    Last Post: 11-10-2011, 05:19 AM

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