I use the attached code as part of a much larger macro.
Cell M8 is formatted as text but contains a 6 digit number sequence starting "0000", eg 000021
When the code is run, the word "DEPOSIT" is replaced, but the result in that cell is "21"
Range A14:A25 is formatted as text.
How can I preserve the string please?
Dim DocType As String
DocType = Range("M8").Value
.Replace What:="DEPOSIT", Replacement:=DocType, LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _