View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default How replace a character in a string of characters?

Chet,
Not sure if you actually have a formula or text in your cells, but...
The default property of a Range is .Value. So that is what you are working
with here, as you do not specify a property in your code.
There is also the .Formula and .HasFormula which may be what you need
instead, if formulae are involved.

For Rowy = 2 To MaxRow
with Cells(Rowy, 11)
If .HasFormula = True Then .value = "'" & .formula
end with
Next Rowy

NickHK

"Chet" wrote in message
oups.com...
Anyone know how to pick out a digit in a string of characters like
this? =---FS- 12345 I am trying to replace the first character and
my code keeps coming back with "type mismatch error 13". My code is
simple (but wrong). I am trying to get rid of the = character and
replace it with a ' .

Thx
Chet

Sub REMOVE_INVALID_DATA_PHX_DOWNLOAD()

MaxRow = ActiveSheet.Range("A65536").End(xlUp).Row

For Rowy = 2 To MaxRow
Target = Left(Cells(Rowy, 11), 1)
If Target = "=" Then Target = "'"
Left(Cells(Rowy, 11), 1) = Target
Next Rowy

End Sub