Substitute Function in Excel VBA for cell range
Try this. Note that it uses the VBA Replace
function, so you need to rename your 'Replace` subroutine.
Sub ReplaceText()
For Each c In Sheets("Sheet1").Range("A1:A629").Cells
c = Replace(c.Value, ",", ";")
Next c
End Sub
Note: This will only work if you have values in the cells, no Formulas. Because Excel has a formula length limit of 1024 characters. But given you have this specific error, your cells must not be formulas.
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