Why this macro not running in 2007

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
328
Dear all,
This macro I was running in Excel2003 since many years

Code:
Sub unprotect_Click()
'
' unprotect_Click Macro
' Macro recorded 11-10-2003 by vipul
'
      
    ActiveSheet.Unprotect
End Sub
Now what's wrong with Excel2007
This macro is in personal.xlsb

This macro is still running with no problem
Sub protect_Click()
'
' protect_Click Macro
' Macro recorded 11-10-2003 by vipul
'
ActiveSheet.Protect

End Sub

Both the codes are there in personal.xlsb
but protect_click is working in any open workbook, but the unprotect_click is not working except that in personal workbook only
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

ParamRay

Well-known Member
Joined
Aug 6, 2014
Messages
1,195
.
.

Could it be that the sheet you're trying to unprotect has a password?

If so, try something like:

ActiveSheet.Unprotect Password:="qwerty"
 

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
328
There is no password as mentioned earlier and is reproduced below:

Code:
Sub protect_Click()
'
' protect_Click Macro
' Macro recorded 11-10-2003 by vipul
'
ActiveSheet.Protect

End Sub

Code:
Sub unprotect_Click()
 '
 ' unprotect_Click Macro
'Macro recorded  11-10-2003 by vipul
'            
ActiveSheet.Unprotect
End Sub

I want to run both codes in any open workbook and hence stored in personal.xlsb
So, my question is why Protect macro runs nicely and why Unprotect is not?
 
Last edited:

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Both procedures work fine for me in Excel 2007. In what way isn't the second one working for you?
 

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
328

ADVERTISEMENT

Its really irritating for me. Its gives me error as under:
Cannot run the macro unprotect_click. The macro may not be available in this workbook or all macros may be disabled.
It was running nicely in excel2003.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,675
Office Version
  1. 2010
Platform
  1. Windows
Its really irritating for me. Its gives me error as under:
Cannot run the macro unprotect_click. The macro may not be available in this workbook or all macros may be disabled.
It was running nicely in excel2003.

When you saved the XL2007 workbook, did you save it as an "Excel Macro-Enabled Workbook (*.xlsm)"?
 

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
328

ADVERTISEMENT

I dont save a work book. I just open new book, say book1
Total vlank workbook, not yet saved.
But my macro protect is rnning nicely. Problem is with unprotect only.
 

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
328
please somebody help, before I uninstall 2007 and go back to old school of using Excel2003
 

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
328
Surprisingly it runs when I try to run in personal.xlsb workbook from ribbon,
but it is not running in any other workbook, when personal.xlsb is in hidden mode
still, protect_click is running....
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
I dont save a work book. I just open new book, say book1
Total vlank workbook, not yet saved.
But my macro protect is rnning nicely. Problem is with unprotect only.
Using Excel 2007 (& other versions) I have not been able to make either procedure fail, even under the circumstances stated here.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,335
Messages
5,595,569
Members
413,996
Latest member
mabelO

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
Top