ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro problem when sheet protected (https://www.excelbanter.com/excel-programming/375743-macro-problem-when-sheet-protected.html)

WLMPilot

Macro problem when sheet protected
 
I have run into a problem with macros not executing when a sheet is protected
in Excel. I use Office XP.

Any ideas on this?

Thanks,
Les

Tom Ogilvy

Macro problem when sheet protected
 
Sub MyMacro()
On Error goto ErrHandler
worksheets("Sheet1").Unprotect Password:="ABC"
' current code

ErrHandler:
Worksheets("sheet1").Protect Password:="ABC"
End Sub

--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

I have run into a problem with macros not executing when a sheet is protected
in Excel. I use Office XP.

Any ideas on this?

Thanks,
Les


WLMPilot

Macro problem when sheet protected
 
Does this code still keep the sheet protected? Also, I have entered macros
before. Is this going to be an EVENT macro?

Thanks,
Les

"Tom Ogilvy" wrote:

Sub MyMacro()
On Error goto ErrHandler
worksheets("Sheet1").Unprotect Password:="ABC"
' current code

ErrHandler:
Worksheets("sheet1").Protect Password:="ABC"
End Sub

--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

I have run into a problem with macros not executing when a sheet is protected
in Excel. I use Office XP.

Any ideas on this?

Thanks,
Les


Tom Ogilvy

Macro problem when sheet protected
 
It unprotects the sheet while it runs and protects it again at the end.

It is meant to present a concept to integrate with your existing macro.
--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

Does this code still keep the sheet protected? Also, I have entered macros
before. Is this going to be an EVENT macro?

Thanks,
Les

"Tom Ogilvy" wrote:

Sub MyMacro()
On Error goto ErrHandler
worksheets("Sheet1").Unprotect Password:="ABC"
' current code

ErrHandler:
Worksheets("sheet1").Protect Password:="ABC"
End Sub

--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

I have run into a problem with macros not executing when a sheet is protected
in Excel. I use Office XP.

Any ideas on this?

Thanks,
Les


WLMPilot

Macro problem when sheet protected
 
It unprotects while the macro executes and then protects it again? I am
trying to only have users access certain cells.

The spreadsheet I initially had the problem with was one that a user could
input their paycheck info for a year. Various statistical info was
calculated on the same and other sheets. I had command buttons that were
used to navigate to specific paychecks (if there were three separate incomes
from three jobs) and to navigate to the other sheets.

If my interpretation is correct, is the macro entered as an EVENT?

Thanks,
Les

"Tom Ogilvy" wrote:

It unprotects the sheet while it runs and protects it again at the end.

It is meant to present a concept to integrate with your existing macro.
--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

Does this code still keep the sheet protected? Also, I have entered macros
before. Is this going to be an EVENT macro?

Thanks,
Les

"Tom Ogilvy" wrote:

Sub MyMacro()
On Error goto ErrHandler
worksheets("Sheet1").Unprotect Password:="ABC"
' current code

ErrHandler:
Worksheets("sheet1").Protect Password:="ABC"
End Sub

--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

I have run into a problem with macros not executing when a sheet is protected
in Excel. I use Office XP.

Any ideas on this?

Thanks,
Les



All times are GMT +1. The time now is 07:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com