Hello!
Does anybody know how I can make the row index (i) to increment by one, once the cursor has reached the 101th column?
What I'm trying to do is to delete all cells that contain the value 99 and shift the contents to the left. This should be done in all cells from Cell(2,2) unitl Cell(476,101). This is what I came up with, and it works, except that it bugs when I try to add another loop to increment the line index... I would very, very, very much appreciate any help!!! Thank you
Sub fabTest()
'
' fabTest Macro
' Macro recorded 1/22/2007 by wyssfab
'
'
Dim i As Integer
Dim k As Integer
k = 2
i = 2
Do
Cells(i, k).Select
Do
If Cells(i, k).Value = 99 Then
Selection.Delete Shift:=xlToLeft
Else: Cells(i, k + 1).Select
End If
Loop Until Cells(i, k).Value <> 99
k = k + 1
Loop Until k = 101
End Sub
Does anybody know how I can make the row index (i) to increment by one, once the cursor has reached the 101th column?
What I'm trying to do is to delete all cells that contain the value 99 and shift the contents to the left. This should be done in all cells from Cell(2,2) unitl Cell(476,101). This is what I came up with, and it works, except that it bugs when I try to add another loop to increment the line index... I would very, very, very much appreciate any help!!! Thank you
Sub fabTest()
'
' fabTest Macro
' Macro recorded 1/22/2007 by wyssfab
'
'
Dim i As Integer
Dim k As Integer
k = 2
i = 2
Do
Cells(i, k).Select
Do
If Cells(i, k).Value = 99 Then
Selection.Delete Shift:=xlToLeft
Else: Cells(i, k + 1).Select
End If
Loop Until Cells(i, k).Value <> 99
k = k + 1
Loop Until k = 101
End Sub