Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:43:22+00:00 2026-06-17T08:43:22+00:00

I was hoping to define some variables and put them within a vlookup formula.

  • 0

I was hoping to define some variables and put them within a vlookup formula. I have outlined below a simple example of what I’m trying to achieve. However I keep getting a ‘438’ error message.

I have put in the original vlookup without the variables and the vlookup with the variables in that are not working. Any input would be appreciated. I believe I have variables defined correctly but I think it’s something to do with the way I’m calling them in the formula.

Sub Macro1()

Dim Lookupcolumn As Range

Dim columnletter_start As String

Dim columnletter_End As String

columnletter_start = ActiveCell.offfet(0, 1).Value

columnletter_End = ActiveCell.offfet(0, 2).Value

Set Lookupcolumn = Sheets("Pricing Analysis").Cells.Find(What:="Cusip", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
        :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False)

'ActiveCell.FormulaR1C1 = "=VLOOKUP(R[1]C[-8],'CS Primeview'!C[-6]:C[-4],3,FALSE)"

ActiveCell.FormulaR1C1 = "=VLOOKUP(Lookupcolumn,'CS Primeview'columnletter_start:columnletter_End,3,FALSE)"


End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:43:23+00:00Added an answer on June 17, 2026 at 8:43 am

    The problem is that indeed you may use any Excel function in your VBA code via Excel.WorksheetFunction. structure and obtain correct results using variables.
    However, for your code ActiveCell.FormulaR1C1 = "=VLOOKUP(Lookupcolumn,'CS Primeview'columnletter_start:columnletter_End,3,FALSE)" you try to use Range object as reference in VLOOKUP, but Excel understands as the argument only valid reference as A1 or Named Region.

    As a solution try to generate A1-similar argument in your code. For the entire column A:A will go. Good luck!

    P.S. One more thing I noticed: 'CS Primeview'columnletter_start:columnletter_End – for this part it seems you missed exclamation before reference, as well as double quotes to concatenate parts, i.e. "'CS Primeview'!" & columnletter_start & ":" & columnletter_End should be correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hoping Paul McGuire may spot this and rescue me... I have grabbed the 'regex
Hoping some learned Rails developers here can recommend an existing Ruby on Rails plugin
I'm getting some strange performance results here and I'm hoping someone on stackoverflow.com can
I have a small question hoping someone will help me. Is there any way
This is an efficiency/best practice question. Hoping to receive some feed back on performance.
Hoping someone can help me with this as I've done some scratching & searching
I'm attempting to create a simple web application for some personal development, but I've
I've been trying to make a basic XOR header file for use in some
Little bit of background, I'm more experienced with Java, and have some C/C++ experience.
I am hoping someone has experienced this issue and can maybe shed some light.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.