View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
BrianB BrianB is offline
external usenet poster
 
Posts: 1
Default replacing varaibles in formula

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