How to say do nothing

C

chrisnsmith

I use this macro I recorded to clear O from my worksheet. If there are no O's
I get an error in the VB debugger. What do I need to add to tell it to do
nothing if there are no O's.?

Sheets("Reg Positions").Select
Range("A6:E700").Select
Selection.sort Key1:=Range("A6"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Cells.Find(What:="O", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False).Activate
Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top