i have a problem with a VBA Vlookup function.
consider below pictures relevant to 2 workbooks
this is the sheet which i need to see output ( i have saved it as "test.xlsx" )
Uploaded with ImageShack.com
this is the CSV file which i use to refer the data( i have saved it as "Time Tracking.CSV" )
Uploaded with ImageShack.com
what i wanted to do is
find the today date from "test.xlsx" row 2 and insert the time in front of relevant plant(in A Column) by getting the values from "Time Tracking" Workbook
as an example
if today is 9th then J3 cell should be 10.57
i have written a VBA for this. but it gives me "Run time error '438'" at Vlookup Line.
here i have give the code which i come up with. please help me to find the error and correct it.
much appreciate any comment
consider below pictures relevant to 2 workbooks
this is the sheet which i need to see output ( i have saved it as "test.xlsx" )
Uploaded with ImageShack.com
this is the CSV file which i use to refer the data( i have saved it as "Time Tracking.CSV" )
Uploaded with ImageShack.com
what i wanted to do is
find the today date from "test.xlsx" row 2 and insert the time in front of relevant plant(in A Column) by getting the values from "Time Tracking" Workbook
as an example
if today is 9th then J3 cell should be 10.57
i have written a VBA for this. but it gives me "Run time error '438'" at Vlookup Line.
here i have give the code which i come up with. please help me to find the error and correct it.
much appreciate any comment
Code:
<code>Sub find_time() Dim i As Integer Workbooks("test.xlsx").Sheets("sheet1").Activate Rows("2:2").Select Rows("2:2").Find(what:=Date, After:=ActiveCell, LookIn:=xlFormulas, _ lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlNext, _ MatchCase:=False, searchformat:=False).Activate For i = 1 To 13 ActiveCell.Offset(i, 0).Activate[B] ActiveCell.Value = Application.WorksheetFunction.VLookup(ActiveCell.End(xlToLeft).Value, Workbooks("Time Tracking").Range("A2:C13"), 3, False)[/B] On Error Resume Next ActiveCell.Offset(-i, 0).Activate Next i End Sub</code></pre>