VBA not working

RattlingCarp3048

Board Regular
Joined
Jan 12, 2022
Messages
202
Office Version
  1. 365
Platform
  1. Windows
i have a case number in column B where i need to filter to all line items containing " ARM" (space ARM) and delete those rows then unfilter. below is the line of code i have used many times in other worksheets without issues. when i manually filter it works as expected. however, when i test in VBA it filters to nothing. no data is shown and none has been deleted. when i try to record the macro i get an error message saying there are too many line continuations. Can someone help figure out what i am doing wrong?

ActiveSheet.Range("$A:$AA").AutoFilter Field:=2, Criteria1:=" ARM"
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A:$AA").AutoFilter Field:=2
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Replace the Delete line with:
VBA Code:
ActiveSheet.Range("A1").CurrentRegion.Offset(1).SpecialCells(xlCellTypeVisible).Delete Shift:=xlUp
 
Upvote 0

Forum statistics

Threads
1,224,547
Messages
6,179,440
Members
452,915
Latest member
hannnahheileen

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