PrivateSub - Filter for Blanks

sguidry

New Member
Joined
Mar 7, 2011
Messages
4
Good Afternoon -

I'm attempting to create a macro that hides all data on Worksheet3 any time I switch to Worksheet2 or Worksheet1 (all within the same workbook). So when I click back over to Worksheet3 from either of the other sheets, there will be no data showing.

I created a private sub within Worksheets 1 and 2 that calls another macro, which should ideally filter for "blanks", thus achieving my goal of hiding all data. For whatever reason, it is not applying any filter to Worksheet3. Any help would be greatly appreciated. Thank you!

--Private Sub included in Worksheet1 and Worksheet2
Private Sub Worksheet_Deactivate()
Call FilterBlank
End Sub

--Sub created to apply to whole workbook
Sub FilterBlank()
Sheets("Worksheet3").Range("A1").AutoFilter Field:=1, Criteria1:=" "
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the board,

This code is placed in the worksheet 3 module,

Code:
Private Sub Worksheet_Activate()
Selection.AutoFilter Field:=1, Criteria1:="="""""
End Sub

it will 'hide' your data, but me thinks you'll be back with another question :biggrin:

HTH
Colin
 
Upvote 0

Forum statistics

Threads
1,222,312
Messages
6,165,268
Members
451,949
Latest member
bovacik

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