VBA Help

JoeyGaspard

Board Regular
Joined
Jul 22, 2019
Messages
147
Hi folks, having another little problem with VBA. I am trying to filter a selection from a worksheet, and delete those rows, my filter is working fine, but its not deleting the rows. Here is the code and a screenshot:
'Clean up GrowthRate
With Sheets("GrowthRate")
.AutoFilterMode = False
With .Range("k2", .Range("k" & Rows.Count).End(xlUp))
.AutoFilter 11, "0"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With

1604679857712.png

Thanks in advance!
 
The code you supplied in post#5 is not using a table, so if that is not the code you are trying to use, please post the code that you are using.
I am sorry for all this confusion, here is the code I am trying to use, and its not for a table, that was my issue, I couldnt figure out how to do it. That is why I started a new thread earlier.

'Clean up GrowthRate
With Sheets("GrowthRate")
.AutoFilterMode = False
With .Range("k2", .Range("k" & Rows.Count).End(xlUp))
.AutoFilter 11, "0"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
On Error GoTo 0
End With
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
What is the name of the table?
 
Upvote 0
with the code I supplied before
VBA Code:
   With Sheets("GeneralJournal").ListObjects("Table1")
      .Range.AutoFilter 1, ""
      Application.DisplayAlerts = False
      .DataBodyRange.SpecialCells(xlVisible).Delete
      .Range.AutoFilter
   End With
Just change the sheet name to suit, the table name (the bit in brackets after ListObjects) to Input & then modify the autofilter column & criteria to suit.
 
Upvote 0
with the code I supplied before
VBA Code:
   With Sheets("GeneralJournal").ListObjects("Table1")
      .Range.AutoFilter 1, ""
      Application.DisplayAlerts = False
      .DataBodyRange.SpecialCells(xlVisible).Delete
      .Range.AutoFilter
   End With
Just change the sheet name to suit, the table name (the bit in brackets after ListObjects) to Input & then modify the autofilter column & criteria to suit.
Thank you very much, again, so sorry for the confusion, your help is appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,720
Members
448,986
Latest member
andreguerra

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