Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

excel vba - changing pathway vlookup

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » excel vba - Changing the pathway of a vlookup

excel vba - Changing the pathway of a vlookup

ResolvedVersion Standard

Steven has attended:
Excel VBA Intro Intermediate course

Changing the pathway of a vlookup

I recorded a macro that has a vlookup to another workbook.
The workbook has been moved to another folder and so when running the macro the screen to select the destination pathway pops up.
In the code it appears as:

ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R[1]C[1],'[CONTRACT LIST.xls]Sheet1'!R2C1:R12C2,2,FALSE)"


It is the workbook "contract list" that has changed location.
Is there a simple way to change where its looking in the code?

RE: Changing the pathway of a vlookup

Hi Steven

The below formula would pint to a file that was located on the desktop.

"=VLOOKUP(R[1]C[1],'C:\WINDOWS\Desktop\[CONTRACT
LIST.xls]Sheet1'!R2C1:R12C2,2,FALSE)"


Just added
'C:\WINDOWS\Desktop\
to the front of the sheet name.

Depending on the location, the address would differ.

Regards

Richard

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Calculate age or service

The DATEDIF() function in Excel calculates the number of days, months, or years between two dates. So, this function makes it easy to calculate a person's age. To try this tip:

In a blank worksheet, type the birth date in cell A1, using slashes to separate day, month, and year.
In cell A2, type =DATEDIF(A1,TODAY(),"y") and press ENTER.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.17 secs.