Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I search an Excel Range?

Status
Not open for further replies.

GusBrown

Programmer
Nov 24, 2000
38
0
0
GB
Hi all,

In Access 97 I've declared an Excel object:

Dim appExcel = Excel.Application
Dim xlsReport = Excel.Workbook

Set appExel = CreateObject("Excel.Application")
Set xlsReport = appExcel.Workbooks.Add("c:\temp.xls")

Then I've populated a worksheet and now I want to search the range Bx:By for a particular string but I can't figure out how to use the .Find function. Can anyone help me out?

Thanks,

Gus
 
Gus,

Try this out...

'Select a range
Excel.Application.Range("A2:A22").Select

'initiate Find for 'XYZ'
Excel.Application.Selection.Find(What:="XYZ", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate -illini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top