Hi all,
I have this bit of code which works for what I need, but I can't find where to specify a certain column.
If I only want it to search column D for the required value, where would I specify this?
ub LookforText()
Dim bk1 As Workbook, sh1 As Worksheet, cell As Range
Dim bk2 As Workbook, sh2 As Worksheet, r As Range
Set bk1 = Workbooks("Credit Hire Review Assistant 3.10.xlsm")
Set sh1 = bk1.Worksheets("Settlement")
Set cell = sh1.Range("F5") ' this remembers the cell where the search string is
' and can be used to produce the value on demand
Set bk2 = Workbooks.Open("S:\Claims\Credit Hire\Credit Hire Spreadsheet\C Hire MI Sept 2011-.xlsx")
Set sh2 = bk2.Worksheets("Sheet1")
Set r = sh2.Cells.Find(What:=cell.Value, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If r Is Nothing Then
MsgBox "Not found"
Else
Application.Goto Reference:=r
End If
End Sub
Bookmarks