Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a single "0" (zero) in find command
I wrote this code and I wanted it to find and delete any single "0"
(zero). However it is deleting any numbers with zeros, I.E. 10, 100, 150, 10,275 etc. Is there a way to write it so it will find a single "0"? The following is the code I wrote. Sub FindZero For x = 1 To 6 Dim rngFound As Range Set rngFound = Cells.Find(What:="0", After:=ActiveCell, _ LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) If Not rngFound Is Nothing Then rngFound.Select Selection.Clear End If Next x End Sub Ogopogo5 *** Sent via Developersdex http://www.developersdex.com *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a single "0" (zero) in find command
add lookat:=xlwhole to you find command
Set rngFound = Cells.Find(What:="0", After:=ActiveCell, _ LookIn:=xlFormulas, LookAt:=xlwhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) "ogopogo5" wrote: I wrote this code and I wanted it to find and delete any single "0" (zero). However it is deleting any numbers with zeros, I.E. 10, 100, 150, 10,275 etc. Is there a way to write it so it will find a single "0"? The following is the code I wrote. Sub FindZero For x = 1 To 6 Dim rngFound As Range Set rngFound = Cells.Find(What:="0", After:=ActiveCell, _ LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) If Not rngFound Is Nothing Then rngFound.Select Selection.Clear End If Next x End Sub Ogopogo5 *** Sent via Developersdex http://www.developersdex.com *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find a single "0" (zero) in find command
Hi Joel
Thank you very much for the help. I copied and paste your code and it works great. Once again, thank you. Ogopogo5 *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to have a macro simply issue the "find" command or "control f: | Excel Programming | |||
Display message if "find" command comes up blank ?? | Excel Programming | |||
Stopping looped "Find" command | Excel Discussion (Misc queries) | |||
How to cancel a find & replace command "midstream"? | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) |