Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot find source of external workbook links Nette Excel Discussion (Misc queries) 1 July 15th 08 05:59 PM
VBA can't find file as it moves from folder to folder pdberger Excel Programming 1 March 8th 07 01:08 AM
external reference to file in the same folder Ragnoff Excel Discussion (Misc queries) 1 July 15th 06 12:15 AM
find all the excel files in a folder. jackm1 Excel Programming 6 July 20th 05 11:00 PM
Find and change external links to point to the same workbook instead Maria J-son Excel Programming 3 June 21st 05 06:57 PM


All times are GMT +1. The time now is 01:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"