View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Finding text and replacing in VBA

Then you have to loop

Sub ReplaceText()
Dim rng as Range
Dim rng1 as Range
Dim cell as Range
set rng = Range("B2:Z26")
On Error Resume Next
set rng1 = rng.specialcells(xlconstants,xlTextValues)
On error goto 0
if not rng1 is nothing then
rng1.Numberformat:="General"
for each cell in rng1
if isnumeric(cell) then
cell.formula = cell.Value
else
cell.Value = 0
end if
Next
end if
End Sub

--
Regards,
Tom Ogilvy

"GregR" wrote in message
ups.com...
Tom, if the text value is a number, such as an account number, how can
I amend the code to change the text value to an actual number. TIA

Greg