!....Excel VBA program to clean trim values according to your selection...!
Sub Remove_Space()
Dim rw As Integer
Dim cl As Integer
Dim c, r As Integer
c = ActiveCell.Column
If ActiveCell = "" Then
MsgBox "Blank or No Cell is Selected"
Exit Sub
End If
For i = 1 To Selection.Columns.Count
r = ActiveCell.Row
For j = 1 To Selection.Rows.Count
Cells(r, c) = Trim(Cells(r, c))
r = r + 1
Next j
c = c + 1
Next i
End Sub
Sub Remove_Space()
Dim rw As Integer
Dim cl As Integer
Dim c, r As Integer
c = ActiveCell.Column
If ActiveCell = "" Then
MsgBox "Blank or No Cell is Selected"
Exit Sub
End If
For i = 1 To Selection.Columns.Count
r = ActiveCell.Row
For j = 1 To Selection.Rows.Count
Cells(r, c) = Trim(Cells(r, c))
r = r + 1
Next j
c = c + 1
Next i
End Sub
No comments:
Post a Comment