ActiveSheet.Range and ActiveSheet.AutoFilter.Range Questions

drozek

Board Regular
Joined
Aug 3, 2011
Messages
67
I have a few questions:

1) I am trying to delete all the rows in Col 4 with #, the code I have is this:
ActiveSheet.Range("$A$1:$AJ$11576").AutoFilter Field:=4, Criteria1:="#"
ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).Delete (xlShiftUp)

2) How do I add multiple things I wanted deleted not just #, like *, & in Col 4



3) I also have a Col 10 with dates "'5/2/2019" "'10/2/2018", how do I delete everything besides last months and year. So I run this report in June and trying just to run May numbers.

Thanks!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
you could do this, no filters

Code:
Sub Macro1()
    Columns("D:D").Select
    Selection.Replace What:="#", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
End Sub
 
Upvote 0
you could do this, no filters

Code:
Sub Macro1()
    Columns("D:D").Select
    Selection.Replace What:="#", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
End Sub

It didn't delete the entire row just that cell
 
Upvote 0
I have a few questions:

1) I am trying to delete all the rows in Col 4 with #, the code I have is this:
ActiveSheet.Range("$A$1:$AJ$11576").AutoFilter Field:=4, Criteria1:="#"
ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).Delete (xlShiftUp)

2) How do I add multiple things I wanted deleted not just #, like *, & in Col 4



3) I also have a Col 10 with dates "'5/2/2019" "'10/2/2018", how do I delete everything besides last months and year. So I run this report in June and trying just to run May numbers.

Thanks!

You can try this
ActiveSheet.Range("$A$1:$AJ$11576").AutoFilter Field:=4, Criteria1:="#", Operator:=xlOr, Criteria2:="*"
ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).Delete (xlShiftUp)

 
Upvote 0

Forum statistics

Threads
1,214,521
Messages
6,120,018
Members
448,937
Latest member
BeerMan23

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