View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jindon[_59_] jindon[_59_] is offline
external usenet poster
 
Posts: 1
Default Search and replace blanks


Hi
try

Code:
--------------------

Sub test()
Dim r As Range
With CreateObject("VBScript.RegExp")
.Pattern = "^(\d+\s?)+$"
For Each r In Activesheet.UsedRange
If .Test(r.Value) Then r.Value = Val(r.Value)
Next
End With
End Sub
--------------------


SamanthaK Wrote:
How do you search an entier spreadsheet and do the following:

1) Check if the contents of a cell is numeric?
2) If content is numeric then search for blanks (" ") and replace them
with
nothing (""). E.g. I hace a number in a cell written like: 1000 22 458
but
want to convert it to 100022458. I do not want text like: 'Market
value' to
be replaced by 'Marketvalue'.

Please help me on this one!!!
--
I am very thankful for any fast assistance!



--
jindon
------------------------------------------------------------------------
jindon's Profile: http://www.excelforum.com/member.php...o&userid=13135
View this thread: http://www.excelforum.com/showthread...hreadid=552144