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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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