Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA - Find value in external workbook, same folder
For any Cost Code there is a related Group code.
I am trying to populate the GroupCode Field in ThisWorkbook.worksheet1 by using a FIND CostCode from another workbook same folder. Dim fso As Object, Source As Object, WS1 As Object, WS2 As Object Dim GroupCode As String Dim StartRow As Integer ' Destination WorkSheet Start Row Set fso = CreateObject("Scripting.FileSystemObject") Set Source = fso.GetFolder("P:\Test") Set WS1 = ThisWorkbook.Sheets(1) Set WS2 = "Group.xls" Application.ScreenUpdating = False Workbooks.Open Filename:=WS2.Path Range("E2").Select R1 = 2 Do While ActiveCell.Value < "" 'The Group Workbook Sheet1 is structured as Column A for CostCode, column B for GroupCode. ' I need help with this syntax GroupCode= WorksheetFunction.Find(WS2.Sheet1,Range("A1:B10"), ActiveCell) WS1.Cells(R1, 14).Value = Group StartRow = StartRow + 1 ActiveCell.Offset(1, 0).Select Loop Application.ScreenUpdating = True End Sub Thank you for your help, Hunter |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cannot find source of external workbook links | Excel Discussion (Misc queries) | |||
VBA can't find file as it moves from folder to folder | Excel Programming | |||
external reference to file in the same folder | Excel Discussion (Misc queries) | |||
find all the excel files in a folder. | Excel Programming | |||
Find and change external links to point to the same workbook instead | Excel Programming |