Hello everyone!
I have a Macro that selects all cells with data.
Now I need to change this Macro to also highlight only the cells that contains blanks spaces in the begging and in the end of the data inside the cells.
This blanks spaces are created normaly by the SpaceBar.
It´s similar to Left Trim and Right Trim, but I just need to highlight the cells that contains this blanks spaces.
Can anyone help me?
Thanks!
I have a Macro that selects all cells with data.
Now I need to change this Macro to also highlight only the cells that contains blanks spaces in the begging and in the end of the data inside the cells.
This blanks spaces are created normaly by the SpaceBar.
It´s similar to Left Trim and Right Trim, but I just need to highlight the cells that contains this blanks spaces.
Can anyone help me?
Thanks!
VBA Code:
Sub Select_All_Cells_with_Data()
Set Rng = ActiveSheet.UsedRange
Rng.Cells(1, 1).Select
For i = 1 To Rng.Rows.Count
For j = 1 To Rng.Columns.Count
If Rng.Cells(i, j) <> "" Then
Union(Selection, Rng.Cells(i, j)).Select
End If
Next j
Next i
End Sub