Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Probelm with macro

Hello,

I have a macro (see below) and it works great. The only problem I am having
is that I want to be able to see in locked cells, and the macro only lets me
go into unlocked cells. I do not want to change the locked cells, just be
able to see formula and where it comes from. Could anyone tell me what I am
doing wrong with this macro?? Any help is greatly appreciated.


For Each Sheet In Worksheets
Range("A1").Select
If Sheet.ProtectContents = False Then
Sheet.Protect Password:="2568", _
DrawingObjects:=True, Contents:=True, _
Scenarios:=True, AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True
EnableSelection = xlUnlockedCells
End If
Next Sheet
Range("A1").Select
' ActiveSheet.UnProtect Password:="2000"
MsgBox "All sheets are now protected!"
End Sub

--
thank you mac
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Probelm with macro

You can view locked cells in a protected worksheet, but not if they
are hidden. Are the cells locked AND hidden?


HTH,
JP

On Jan 14, 11:22*am, mac wrote:
Hello,

I have a macro (see below) and it works great. *The only problem I am having
is that I want to be able to see in locked cells, and the macro only lets me
go into unlocked cells. I do not want to change the locked cells, just be
able to see formula and where it comes from. *Could anyone tell me what I am
doing wrong with this macro?? Any help is greatly appreciated.

For Each Sheet In Worksheets
* * * * Range("A1").Select
* * * * If Sheet.ProtectContents = False Then
* * * * * * Sheet.Protect Password:="2568", _
* * * * * * * * DrawingObjects:=True, Contents:=True, _
* * * * * * * * Scenarios:=True, AllowFormattingCells:=True, _
* * * * * * * * AllowFormattingColumns:=True, _
* * * * * * * * AllowFormattingRows:=True
* * * * * * * * EnableSelection = xlUnlockedCells
* * * * End If
* * Next Sheet
* * *Range("A1").Select
' * *ActiveSheet.UnProtect Password:="2000"
* * MsgBox "All sheets are now protected!"
End Sub

--
thank you mac


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Probelm with macro

No they are only locked. I added the last line

EnableSelection = xlUnlockedCells

hoping that would do it, but I cannot go to any of the cells. Any ideas why
it would not work? Any help is greatly appreciated.
--
thank you mac


"JP" wrote:

You can view locked cells in a protected worksheet, but not if they
are hidden. Are the cells locked AND hidden?


HTH,
JP

On Jan 14, 11:22 am, mac wrote:
Hello,

I have a macro (see below) and it works great. The only problem I am having
is that I want to be able to see in locked cells, and the macro only lets me
go into unlocked cells. I do not want to change the locked cells, just be
able to see formula and where it comes from. Could anyone tell me what I am
doing wrong with this macro?? Any help is greatly appreciated.

For Each Sheet In Worksheets
Range("A1").Select
If Sheet.ProtectContents = False Then
Sheet.Protect Password:="2568", _
DrawingObjects:=True, Contents:=True, _
Scenarios:=True, AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True
EnableSelection = xlUnlockedCells
End If
Next Sheet
Range("A1").Select
' ActiveSheet.UnProtect Password:="2000"
MsgBox "All sheets are now protected!"
End Sub

--
thank you mac



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Probelm with macro

I tested your code and was not able to duplicate your problem.

I created a blank workbook with 5 worksheets and put some random
numbers and some simple formulas in the first sheet. I hit Ctrl-A and
on the "Protection" tab I checked "Locked" and unchecked "Hidden."
Then I ran your macro and I was able to select and view the values and
formulas I previously entered.

The only way I was unable to view a cell was when the cells were
hidden (regardless of whether they were locked).

Is there anything you might have left out?

--JP

On Jan 14, 12:54*pm, mac wrote:
No *they are only locked. *I added the last line

EnableSelection = xlUnlockedCells

hoping that would do it, but I cannot go to any of the cells. *Any ideas why
it would not work? *Any help is greatly appreciated. *
--
thank you mac



"JP" wrote:
You can view locked cells in a protected worksheet, but not if they
are hidden. Are the cells locked AND hidden?


HTH,
JP


On Jan 14, 11:22 am, mac wrote:
Hello,


I have a macro (see below) and it works great. *The only problem I am having
is that I want to be able to see in locked cells, and the macro only lets me
go into unlocked cells. I do not want to change the locked cells, just be
able to see formula and where it comes from. *Could anyone tell me what I am
doing wrong with this macro?? Any help is greatly appreciated.


For Each Sheet In Worksheets
* * * * Range("A1").Select
* * * * If Sheet.ProtectContents = False Then
* * * * * * Sheet.Protect Password:="2568", _
* * * * * * * * DrawingObjects:=True, Contents:=True, _
* * * * * * * * Scenarios:=True, AllowFormattingCells:=True, _
* * * * * * * * AllowFormattingColumns:=True, _
* * * * * * * * AllowFormattingRows:=True
* * * * * * * * EnableSelection = xlUnlockedCells
* * * * End If
* * Next Sheet
* * *Range("A1").Select
' * *ActiveSheet.UnProtect Password:="2000"
* * MsgBox "All sheets are now protected!"
End Sub


--
thank you mac- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Probelm with macro

JP

As OP protected the sheet with "select locked cells" disabled he would not be
able to select a locked cell to see the formula.


Gord Dibben MS Excel MVP

On Mon, 14 Jan 2008 10:17:00 -0800 (PST), JP wrote:

I tested your code and was not able to duplicate your problem.

I created a blank workbook with 5 worksheets and put some random
numbers and some simple formulas in the first sheet. I hit Ctrl-A and
on the "Protection" tab I checked "Locked" and unchecked "Hidden."
Then I ran your macro and I was able to select and view the values and
formulas I previously entered.

The only way I was unable to view a cell was when the cells were
hidden (regardless of whether they were locked).

Is there anything you might have left out?

--JP

On Jan 14, 12:54*pm, mac wrote:
No *they are only locked. *I added the last line

EnableSelection = xlUnlockedCells

hoping that would do it, but I cannot go to any of the cells. *Any ideas why
it would not work? *Any help is greatly appreciated. *
--
thank you mac



"JP" wrote:
You can view locked cells in a protected worksheet, but not if they
are hidden. Are the cells locked AND hidden?


HTH,
JP


On Jan 14, 11:22 am, mac wrote:
Hello,


I have a macro (see below) and it works great. *The only problem I am having
is that I want to be able to see in locked cells, and the macro only lets me
go into unlocked cells. I do not want to change the locked cells, just be
able to see formula and where it comes from. *Could anyone tell me what I am
doing wrong with this macro?? Any help is greatly appreciated.


For Each Sheet In Worksheets
* * * * Range("A1").Select
* * * * If Sheet.ProtectContents = False Then
* * * * * * Sheet.Protect Password:="2568", _
* * * * * * * * DrawingObjects:=True, Contents:=True, _
* * * * * * * * Scenarios:=True, AllowFormattingCells:=True, _
* * * * * * * * AllowFormattingColumns:=True, _
* * * * * * * * AllowFormattingRows:=True
* * * * * * * * EnableSelection = xlUnlockedCells
* * * * End If
* * Next Sheet
* * *Range("A1").Select
' * *ActiveSheet.UnProtect Password:="2000"
* * MsgBox "All sheets are now protected!"
End Sub


--
thank you mac- Hide quoted text -


- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Probelm with macro

EnableSelection = xlNoRestrictions


Gord Dibben MS Excel MVP

On Mon, 14 Jan 2008 08:22:01 -0800, mac wrote:

Hello,

I have a macro (see below) and it works great. The only problem I am having
is that I want to be able to see in locked cells, and the macro only lets me
go into unlocked cells. I do not want to change the locked cells, just be
able to see formula and where it comes from. Could anyone tell me what I am
doing wrong with this macro?? Any help is greatly appreciated.


For Each Sheet In Worksheets
Range("A1").Select
If Sheet.ProtectContents = False Then
Sheet.Protect Password:="2568", _
DrawingObjects:=True, Contents:=True, _
Scenarios:=True, AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True
EnableSelection = xlUnlockedCells
End If
Next Sheet
Range("A1").Select
' ActiveSheet.UnProtect Password:="2000"
MsgBox "All sheets are now protected!"
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
AV probelm with Office 2007 John Excel Discussion (Misc queries) 2 October 6th 06 09:37 PM
Probelm opening an excel 2000 file in excel 2003 Mark Excel Discussion (Misc queries) 1 February 13th 06 07:47 AM
Hyperlink probelm Glenn Richardson Excel Worksheet Functions 2 August 30th 05 02:26 PM
Hyperlink probelm Glenn Richardson Excel Discussion (Misc queries) 1 August 30th 05 01:44 PM


All times are GMT +1. The time now is 04:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"