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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to search for a string in excel and get the cell address?

Status
Not open for further replies.

bigracefan

Programmer
Apr 2, 2002
304
US
I'm trying to read an excel sheet to see if a value exists. If it does I want to increment an adjacent cell, if it doesn't exist I want to add it. I've been trying to use

.Cells.Find(What:=fTestName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Active

But I get an object variable error or with block variable not set.

Thanks.
 
you really need to study the excel object library.
 
chadt... much respect, you answer mucho questions but... hey give the chap a break!!

i think (and im speculating cos i cant see all your code) that you will be needing

Range.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte)

the cells property is pretty redundant (my opinion!!)

good luck!!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
The Great Date Debate Thread222-368305
File Formats Galore @ or
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top