Home |
Search |
Today's Posts |
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Nigel,
The code kept bombing on mycode = Application.WorksheetFunction.VLookup(. Range("B4"), Sheets("Trans Types & Sources").Range("C1:I5"), 7, False), Run Time Error '9' Subscript out of range. I changed Sheets("Trans Types & Sources") to ThisWorkbook.Worksheets("Trans Types & Sources") and this worked brillantly. Your help is greatly appreciated and your worth your weight in gold. Many thanks again ViViC Nigel wrote: Use VLOOKUP function. Try it using a worksheet formula, then incorporate it into your code use Application.Workbook Function With ActiveSheet mycode = Application.WorksheetFunction.VLookup(.Range("B4") , Sheets("Trans Types & Sources").Range("C1:I5"), 7, False) End With The above assumes your lookup table is in the range C1:I5, change as required. myCode can then be substituted for the xxxxx's in your file name. fname = "XXAR_INVOICES_102_" & myCode & "WORKCOMP_" _ & Format(Range("G4").Value, "yyyy_mm_dd_" & Format(Now, "hh-mm-ss")) Hi All, [quoted text clipped - 63 lines] ViViC -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200712/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Naming a workbook WITHOUT saving it? | Excel Programming | |||
Naming new workbook | Excel Programming | |||
Workbook naming | Excel Programming | |||
Workbook naming | Excel Programming | |||
Workbook naming | Excel Programming |