Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have "G:\04 Assembly Cost\+06 FY
03_04\TCR2003_Assembly_0305.xls" in a variable path1 and the worksheet name "TCR2003 by packages" in another variable "wkshName". how can I replace the 'G:\04 Assembly Cost\+06 FY 03_04\[TCR2003_Assembly_0305.xls]TCR2003 by packages' in the vlookup formula below by the variables path1 and wkshName??? Cells(rowSt, z) = "=( VLOOKUP(" & Cells(rowSt, packRng.Column).Address & ",'G:\04 Assembly Cost\+06 FY 03_04\[TCR2003_Assembly_0305.xls]TCR2003 by packages'!$B$4:$G$251,4,FALSE)" & ")" Thanks monika |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is better to break it down as much as possible, so something lik
this (UNTESTED - but you should get the idea) :- '--------------------------------------------- Sub test() Dim MyPath As String Dim MyBook As String Dim MySheet As String '-------------------------------- MyPath = "G:\04 Assembly Cost\+06 FY 03_04\" MyBook = "TCR2003_Assembly_0305.xls" MySheet = "TCR2003" '------------------------------------------ ActiveSheet.Cells(rowSt, z).Value = _ "=(VLOOKUP(" & Cells(rowSt, packrng.Column).Address _ & ",'" & MyPath _ & "[" & MyBook & "]" _ & MySheet & "'" _ & "!$B$4:$G$251,4,FALSE))" End Sub '------------------------------------------------- -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Replacing ISERROR Formula | Excel Worksheet Functions | |||
help on replacing this formula | Excel Discussion (Misc queries) | |||
replacing text within a formula | Excel Worksheet Functions | |||
Replacing a value from a formula | Excel Programming | |||
Replacing DirectPrecedents in a Formula | Excel Programming |