Hi Guys,
I need to remove blanks from a variable range e4:g - variable ive managed to replace the blanks but only on a fixed range.
here is what I have.
I need to remove blanks from a variable range e4:g - variable ive managed to replace the blanks but only on a fixed range.
here is what I have.
Code:
Private Sub cmdClean_Click()
Const sBad As String = "`!@#$;^()_-=+{}&[]\|;:'"",.<>/?"
Dim cell As Range
Dim s As String
Dim i As Long
Application.ScreenUpdating = False
For Each cell In Range("E4:G50")
If VarType(cell.Value) = vbString Then
s = cell.Value
For i = 1 To Len(sBad)
s = Replace(s, Mid(sBad, i, 1), " ")
Next i
cell.Value = Application.Trim(s)
End If
Next cell
For Each c In Worksheets("Retso").Range("e4:G15")
If c.Value = "" Then
c.Value = "TEST"
End If
Next c
Application.ScreenUpdating = True
End Sub