detriez
Board Regular
- Joined
- Sep 13, 2011
- Messages
- 193
- Office Version
- 365
- Platform
- Windows
I am trying to get this to replace all instances of "-" or "/" with a space when column B is populated
This is throwing a run-time '1004': error Method 'Range' of object'_Global failed
This is throwing a run-time '1004': error Method 'Range' of object'_Global failed
Code:
Sub CleanPhone(control As IRibbonControl)
Dim s As String
lr = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row + 1
Application.ScreenUpdating = False
With Range("O:O" & lr)
s = lr
junk = Array("(", ")", "-", "/")
For Each a In junk
s = Replace(s, a, " ")
Next a
End With
Application.ScreenUpdating = True
End Sub