View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jef Gorbach[_2_] Jef Gorbach[_2_] is offline
external usenet poster
 
Posts: 65
Default Find a value in a worksheet

close, what he means is alter you code to use "whatever" as a place-
holder variable for the Find results like so:

Dim whatever as Range
Open strFile1 For Input As #1
Open strFile2 For Output As #2
Workbooks.Open FileName:=strFile3
Do While Not EOF(1)
Line Input #1, MyRecord
MyFields = Split(MyRecord, ",")
For FieldPointer = LBound(MyFields) To UBound(MyFields)
strVar1 = MyFields(0)
strVar2 = MyFields(1)
strVar3 = MyFields(2)
set whatever = cells.Find(What:=strVar2, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate

'Process data
'at this point the variable "whatever" contains the
'current find results so you could use whatever.row
'to access the currently found row for example

Next
Loop