Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to say do nothing
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to say do nothing
It looks to me like you could just delete that .Find line.
chrisnsmith wrote: 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 -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to say do nothing
That did it. Thanks
"Dave Peterson" wrote: It looks to me like you could just delete that .Find line. chrisnsmith wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|