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!

Using Find Function in VB

Status
Not open for further replies.

Tuff

Instructor
Mar 17, 2003
19
AU
Hi Guys I am stuck.

I am using the find function to get a cell reference in an excel spreadsheet, but then I need to move up one cell (as it is the cell above the one it finds that I want to delete).

I can get it go to the cell that I want it to find, but then I can get it to move one cell UP.

How do I do it?
 
Hi Tuff,

Use Offset. You can do it all in one with the Find if you like.

Code:
Cells.Find(What:="SearchText", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Offset(-1).ClearContents

Or if you want to separate it out, after the Find code:

Code:
ActiveCell.Offset(-1).ClearContents

Enjoy,
Tony
 
Thanking you.

Worked perfectly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top