I am struggling to get this right -
This looks to see if the contents of a cell begin with a letter - if it is a letter then delete the cell and shift left. It loops until it finds a blank cell. I need it to repeat the process until the cell begins with a number.
This code works, but only checks each cell once and then moves to the next cell:
I have tried this code and it works on the 1st row, but will not go to the next row and hangs:
I am sure I need an "ISERROR" or something, but I cannot figure it out. Thanks for any help.
This looks to see if the contents of a cell begin with a letter - if it is a letter then delete the cell and shift left. It loops until it finds a blank cell. I need it to repeat the process until the cell begins with a number.
This code works, but only checks each cell once and then moves to the next cell:
Code:
Dim irow As Integer
irow = 2
Do While Len(Cells(irow, 2)) > 0
If Val(Left(Cells(irow, 2), 1)) = IsText Then
Cells(irow, 2).Delete Shift:=xlShiftToLeft
End If
irow = irow + 1
Loop
I have tried this code and it works on the 1st row, but will not go to the next row and hangs:
Code:
Dim irow As Integer
irow = 2
Do While Len(Cells(irow, 2)) > 0
If Val(Left(Cells(irow, 2), 1)) = IsText Then
Cells(irow, 2).Delete Shift:=xlShiftToLeft
Else: End
End If
irow = irow + 1
Loop
I am sure I need an "ISERROR" or something, but I cannot figure it out. Thanks for any help.