H
hunter.rogers
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
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