I have to replace one character with another in Excel file.
I have used following Replace
function, but due to exceeds of 1024 character limit in some cells, it stops there.
Sub Replace()
With Sheets("Sheet1").Range("A1:A629")
.Cells.Replace ",", ";", xlPart, xlByRows, False
End With
End Sub
I got to know Substitute
function would do
Cells(1, 2) = "=SUBSTITUTE(A1,"","","";"")"
But how do I use that for cell range?
Try this
Sub Replace()
Dim rng As Range, cell As Range
Set rng = Sheets("Sheet1").Range("A1:A629")
For Each cell In rng
cell = WorksheetFunction.Substitute(cell, ",", ";")
Next
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With