Macro doesn't capture all data

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
 
M

MarkHear1

Hi,


I think you should delete one of these statement.

Regards,

Manu/


Manu,

Thank you for your suggestion, it wasn't quite right, but guided me
to the solution to my problem, i needed to change that section of code
to ...

activecell.Offset(1, 0).Activate
Else
activecell.Offset(1, 0).Activate
End If
Next AbC

I must have messed it up when fiddling with the code.

Thanks again,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top