Hi - I want to create a code that searches column T for "1" and replace this with "0001" (so it must be custom formatted to "0000", otherwise the number will be shown as "1" instead). I've done a similar replace/format code for "û" which works perfectly, so I don't know why it keeps giving me a debug error for "0001" code. I have 2000 rows.
Works perfectly:
Need help with:
I get Run-Time error '1004': Application-defined or object-defined error for line item "Application.ReplaceFormat.NumberFormat = "0000"
I tried to change it to "Application.ReplaceFormat.NumberFormat = "@" so it is formatted as text instead of custom, but that did not fix the issue, because the number still shows up as 1, rather than 0001.
Could someone please assist?
Works perfectly:
Code:
'In column C, replace û with -.
Columns("C:C").Select
Application.ReplaceFormat.NumberFormat = "General"
Selection.Replace What:="û", Replacement:="-", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=True
Range("C1").Select
Need help with:
Code:
'In column T, replace 1 with 0001.
Application.ReplaceFormat.NumberFormat = "0000"
Selection.Replace What:="1", Replacement:="0001", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=True
Range("T1").Select
I get Run-Time error '1004': Application-defined or object-defined error for line item "Application.ReplaceFormat.NumberFormat = "0000"
I tried to change it to "Application.ReplaceFormat.NumberFormat = "@" so it is formatted as text instead of custom, but that did not fix the issue, because the number still shows up as 1, rather than 0001.
Could someone please assist?