LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Finding text and replacing in VBA

Hi,
The following will replace any cell which has non-numeric data with
0; this will include data such as ABC123 or 12AB45 etc. which will be set to
0 not 0123 or 12045. Is this what you want?

It looks as though you need to add code which checks for numeric-only input
to avoid a repeat of this problem.

Sub ReplaceTextWithZero()
Dim rng As Range, cell
Set rng = Range("a1:Z1000") ' <==== Replace as required
For Each cell In rng
If Not IsNumeric(cell) Then
cell.Value = 0
End If
Next cell
End Sub


HTH
" wrote:

Dear All,

we have a pricing template that some turkeys decide to include text in
it when filling it out.

How can I find and replace ANY text that appears in the range? The
variance of entered text is huge, so there is no way to find and
replace specific text.

We want to replace any text with a zero ("0").

Basically, we need to go from cell to cell, find an instance of text,
then replace it with zero.

Help would be greatly appreciated...

Regards,

andym


 
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
finding and replacing text with a blank Tom Excel Discussion (Misc queries) 2 May 10th 09 12:01 AM
finding and replacing HELPNEEDED!! Excel Worksheet Functions 2 July 3rd 08 01:17 PM
Finding and Replacing Jan Excel Discussion (Misc queries) 3 January 11th 07 05:50 PM
Finding, Replacing and Cut & Paste cs_vision Excel Worksheet Functions 3 April 26th 06 09:23 PM
Finding and Replacing a "?" Mcobra41 Excel Discussion (Misc queries) 2 March 9th 05 06:57 PM


All times are GMT +1. The time now is 10:48 AM.

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

About Us

"It's about Microsoft Excel"