parscon
09-23-2014, 07:50 AM
I have code that will remove the comma at start and end of string but it will be work on rage D1:D40000 and i need check all the row of the column that has data maybe 200000 and etc ,,,
So how can i change this code to check all the data on column D
Thank uoi
Sub Replacer2()
Dim rCell As Range, strChar As String
strChar = ","
For Each rCell In Worksheets("Sheet2").Range("D1:D40000").Cells
If Left(rCell.Value, 1) = strChar Then
rCell.Value = Mid(rCell.Value, 2, Len(rCell.Value) - 1)
ElseIf Right(rCell.Value, 1) = strChar Then
rCell.Value = Left(rCell.Value, Len(rCell.Value) - 1)
End If
Next rCell
End Sub
So how can i change this code to check all the data on column D
Thank uoi
Sub Replacer2()
Dim rCell As Range, strChar As String
strChar = ","
For Each rCell In Worksheets("Sheet2").Range("D1:D40000").Cells
If Left(rCell.Value, 1) = strChar Then
rCell.Value = Mid(rCell.Value, 2, Len(rCell.Value) - 1)
ElseIf Right(rCell.Value, 1) = strChar Then
rCell.Value = Left(rCell.Value, Len(rCell.Value) - 1)
End If
Next rCell
End Sub