VBA Excel Delete & Filter

BalthazarKilmeany

New Member
Joined
May 11, 2018
Messages
3
Hi All,

I would like to know if its possible to do the following.

I am currently using a short piece of VBA code to strip out extra columns of data i dont require from our softwares report utility.

The VBA Code is working fine, however, i wanted to know if i can add some extra code to add a filter to Row 1 then produce results based on a certain value.

Sub sbVBS_To_Delete_Specific_Multiple_Columns() Sheets("Events").Range("B:B,D:D,E:E,F:L,N:X").EntireColumn.Delete
End Sub

This then leaves me with Columns A, B, C, D, E,

I now want to add a filter to Row 1 (Column Headings)

and then filter Column C based on a specific value such as "11489".

Can you help?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
insert this

Code:
Dim lr As Long
    lr = Range("C" & Rows.Count).End(xlUp).Row
    Range("A1:E1").AutoFilter
    Range("$A$1:E" & lr).AutoFilter Field:=2, Criteria1:="11489"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,219
Members
453,024
Latest member
Wingit77

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