Hi All,
I have a report downloaded from a mainframe system that has blank cells in column A. These are not really blank cells or NullValueString. Some of them have 1 space others have 2 or 3....up to 8 spaces.
I want to set up a variable to loop through them, something like nSpance = len(cells(i,1)). This would not work because the cells that are with contents would also return a number. Thanks in advance for your help.
Here is my code without the variable:
Sub VariableSpace()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To FinalRow
If Cells(i, 1).Text = " " Then
Cells(i, 1).Value = "One space"
ElseIf Cells(i, 1).Value = " " Then
Cells(i, 1).Value = "Two spaces"
ElseIf Cells(i, 1).Value = " " Then
Cells(i, 1).Value = "Three spaces"
End If
Next i
End Sub
I have a report downloaded from a mainframe system that has blank cells in column A. These are not really blank cells or NullValueString. Some of them have 1 space others have 2 or 3....up to 8 spaces.
I want to set up a variable to loop through them, something like nSpance = len(cells(i,1)). This would not work because the cells that are with contents would also return a number. Thanks in advance for your help.
Here is my code without the variable:
Sub VariableSpace()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To FinalRow
If Cells(i, 1).Text = " " Then
Cells(i, 1).Value = "One space"
ElseIf Cells(i, 1).Value = " " Then
Cells(i, 1).Value = "Two spaces"
ElseIf Cells(i, 1).Value = " " Then
Cells(i, 1).Value = "Three spaces"
End If
Next i
End Sub