Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have a macro simply issue the "find" command or "control f: Charles Adams Excel Programming 3 February 6th 09 06:34 PM
Display message if "find" command comes up blank ?? [email protected] Excel Programming 5 September 27th 07 08:10 PM
Stopping looped "Find" command Varne Excel Discussion (Misc queries) 3 September 24th 07 09:26 AM
How to cancel a find & replace command "midstream"? Matt from GVA Excel Worksheet Functions 4 September 4th 06 05:47 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM


All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"