excel vba - changing pathway vlookup

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

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

resolvedResolved · Low Priority · Version 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:

Applying and removing border from cell in Excel 2010

Did you know the shortcut key for applying and removing the outline border for a cell?

CTRL+SHIFT+& Applies the outline border to the selected cells.
CTRL+SHIFT_ Removes the outline border from the selected cells.

View all Excel hints and tips


Server loaded in 0.08 secs.