Strange Problem - Step Into fine, Run fails

hdbkiwi

New Member
Joined
Sep 22, 2014
Messages
10
Hi Everyone,

I am getting the weirdest thing happen to me when I try and run a code.

When I run it via "step into" and hold down F8, everything works perfectly. When I just hit run and it does it (way faster), it skips deleting out columns in my autofilter function. I've tried everything, removing for loops, removing excess code, but it just doesn't seem to work. The portion of my code that seems to be affected is below:

Code:
With Sheets(J)
    .Range("$A$2:$BA$5968").AutoFilter Field:=3, Criteria1:="<>Current", Criteria2:="<>Vacant"
    .AutoFilter.Range.Delete
    .AutoFilterMode = False
End With
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
perhaps this..

Code:
   With Sheets(J)
    .Range("$A$2:$BA$5968").AutoFilter Field:=3, Criteria1:="<>Current", Criteria2:="<>Vacant"
    .Range("$A$3:$BA$5968").SpecialCells(xlCellTypeVisible).EntireRow.Delete   '' would delete entire row
    .AutoFilterMode = False
End With
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top