keith05281967
Board Regular
- Joined
- May 6, 2011
- Messages
- 68
Greetings,
The below code loops thru a column of data and adds spacing where needed. But currently if it finds a blank cell it errors out. I need a line of code that says if you find a blank cell then move on to the next row. The code in red doesn't work because it's looking for another "For" but the logic gives the basic idea of what i'm trying to accomplish.
For i = 2 To lastrow
If Cells(i, ColumnnNmber).Value = "" Then
Next i
Else
s = Cells(i, ColumnNumber).Value
s = Trim(s)
s = Left(s, Len(s) - 2) & " " & Right(s, 2)
Cells(i, ColumnNumber).Value = s
Next i
running Excel 2007
thank,
Keith
The below code loops thru a column of data and adds spacing where needed. But currently if it finds a blank cell it errors out. I need a line of code that says if you find a blank cell then move on to the next row. The code in red doesn't work because it's looking for another "For" but the logic gives the basic idea of what i'm trying to accomplish.
For i = 2 To lastrow
If Cells(i, ColumnnNmber).Value = "" Then
Next i
Else
s = Cells(i, ColumnNumber).Value
s = Trim(s)
s = Left(s, Len(s) - 2) & " " & Right(s, 2)
Cells(i, ColumnNumber).Value = s
Next i
running Excel 2007
thank,
Keith