Macro missing from list?

SamAnnElizabeth

New Member
Joined
Mar 15, 2013
Messages
34
I recorded a Macro and then went to edit it in VBA. This is what I have:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)
'
' Protect Macro
'


'
Sheets("Program").Visible = True
Sheets("List1").Visible = True
Sheets("Status").Visible = True
Sheets(Array("Program", "Status", "List1")).Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("All Programs").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
Range("Current", "Rating").Select
Range("Issues").Select
Selection.Locked = False

End Sub


When I try to run it (the play button) a dialogue box pops up to pick a macro, and my macro isn't on the list! Any advice on how to fix it? Thanks!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You have this as an event macro that fires automatically not a as user runnable macro.
 
Upvote 0
the macro is "Private" so will not display. The macro you have is setup to run automatically by the condition stated (beforesave)
 
Upvote 0
I want it to hide the sheets listed, then protect the 'All Programs' sheet, except I want my named ranges to be editable. I want it to perform automatically when the document is saved. I'm trying to lock the whole sheet, then unlock those ranges.

Am I close?
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

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