![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 06:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com