I am using VB6.3 out of excel and I have the following section of code:
(The variables are set previously in the macro and I have showed the Dims just for reference)
The problem is that when it loops to the top for some reason it is not using the new currcell that it is set to at the bottom. It is using the same currcell that it started with? What am I missing?
Thanks for any input.
Code:
Dim rownum As Integer
Dim colnum As Integer
Dim currcell As Range
Dim UnmatchedCount As Integer
Dim CTDate As String
If UnmatchedCount > 0 Then
rownum = Blockrow1
Set currcell = ActiveSheet.Cells(rownum, colnum)
colnum = colnum + 1
CTDate = ActiveSheet.Cells(rownum, colnum).Value
colnum = colnum - 1
Do While currcell <> ""
If currcell.Interior.ColorIndex = 33 Then
currcell.Select
Selection.Delete Shift:=xlUp
colnum = colnum - 1
Set currcell = ActiveSheet.Cells(rownum, colnum)
currcell.Select
Selection.Delete Shift:=xlUp
colnum = colnum + 2
Set currcell = ActiveSheet.Cells(rownum, colnum)
currcell.Select
Selection.Delete Shift:=xlUp
colnum = colnum - 1
Else
colnum = colnum + 1
Set currcell = ActiveSheet.Cells(rownum, colnum)
currcell = CTDate
colnum = colnum - 1
rownum = rownum + 1
End If
Set currcell = ActiveSheet.Cells(rownum, colnum)
Loop
End If
The problem is that when it loops to the top for some reason it is not using the new currcell that it is set to at the bottom. It is using the same currcell that it started with? What am I missing?
Thanks for any input.
Comment