VBA adaptation - Help!

ElsiE93

New Member
Joined
Dec 5, 2018
Messages
17
Hi guys,

I'm looking to create a macro to automatically filter out any data from one tab that matches any values in my Mids tab Column C. To do this, I have used a countif function to work out if there is a match or not then filter out the true values. Once done, I use some other VBA code to delete any hidden rows.

I did this manually by recording the macro but when I re-runit it did not do the same thing.
All my data disappears, filters are applied to the headersand Column C (Compass?) has the Header as an option to filter by.
I’m needing this to also be dynamic as the number of rows tobe assessed will vary.
Coding I have is below. Any help you could give me would be greatly appreciated!
Sub Compass_Remove_2()
'
' Compass_Remove_2 Macro
'
'
Columns("C:C").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C1").Select
ActiveCell.FormulaR1C1 = "Compass?"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(Mids!R2C3:R804C3,RC2)>0"
Range("C2").Select
Selection.FillDown
ActiveSheet.Range("$A$1:$Z$106").AutoFilter Field:=3, Criteria1:="FALSE"
End Sub
 
@Mentor82
When posting code please use code tags, the # icon in the reply window
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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