M
MarkHear1
Hello all,
I have written the code below, which appears to work ok, but it
doesn't capture all of the data that it should...i think this could be
because the macro is running too quickly and doesn't give its self
chance, is this true? Is there anyway I can fix the problem? Or is
this happening for another reason?
All help/suggestions will be greatly appreciated.
Many Thanks,
Mark
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim LOOPAMOUNT As Integer
pastecellnum = 1
TEXTROW = TextBox1.Value
Range("Sheet1!B65536").Activate
Selection.End(xlUp).Select
BOTTOMCELL = activecell.Row
RowCount = BOTTOMCELL - TEXTROW
Range("B" & TEXTROW).Select
For AbC = 1 To RowCount
If activecell.Interior.ColorIndex = xlNone Or
activecell.Interior.ColorIndex = 2 Then
activecell.EntireRow.Copy
Range("Outstanding!A" & pastecellnum).PasteSpecial
pastecellnum = pastecellnum + 1
activecell.Offset(1, 0).Activate
End If
activecell.Offset(1, 0).Activate
Next AbC
Application.ScreenUpdating = True
End Sub
I have written the code below, which appears to work ok, but it
doesn't capture all of the data that it should...i think this could be
because the macro is running too quickly and doesn't give its self
chance, is this true? Is there anyway I can fix the problem? Or is
this happening for another reason?
All help/suggestions will be greatly appreciated.
Many Thanks,
Mark
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim LOOPAMOUNT As Integer
pastecellnum = 1
TEXTROW = TextBox1.Value
Range("Sheet1!B65536").Activate
Selection.End(xlUp).Select
BOTTOMCELL = activecell.Row
RowCount = BOTTOMCELL - TEXTROW
Range("B" & TEXTROW).Select
For AbC = 1 To RowCount
If activecell.Interior.ColorIndex = xlNone Or
activecell.Interior.ColorIndex = 2 Then
activecell.EntireRow.Copy
Range("Outstanding!A" & pastecellnum).PasteSpecial
pastecellnum = pastecellnum + 1
activecell.Offset(1, 0).Activate
End If
activecell.Offset(1, 0).Activate
Next AbC
Application.ScreenUpdating = True
End Sub