Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SaveProtect&Close and Lockcells


I have two macros that work fine individually, but I can't seem to pu
the Lock Cells one into the protectsaveclose one and get it to work
What I have is a worksheet where I have a button set up doing th
ProtectSave&Close which managers use and when we want to send it t
people to use, however there are these Ranges where we don't wan
people to edit data because they've been abusing this worksheet. So i
I do the locked cells and then manually protect the sheet, save&close
when I open it up those ranges are still locked, however if I put th
bottom macro into the top macro, either when I re-open the file I ca
type into those ranges, or depending where I put it I get a compilie
error that tells me "Unable to set the locked property of the rang
class". Any help would be greatly appreciated.




Sub ProtectSaveClose()
'
' ProtectSaveClose Macro
' Macro recorded 3/4/2005 by XXXXX
'

'

Range("A1").Select
Dim wSheet As Worksheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
wSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
End If
Next wSheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
UserForm3.Show
End If
Next wSheet
Application.DisplayAlerts = False
ThisWorkbook.Close savechanges:=True


End Sub


Sub Lock_Cells()
'
' Lock_Cells Macro
' Macro recorded 7/28/2006 by XXXXX
'
' Keyboard Shortcut: Ctrl+c
'
Range("Rates").Select
ActiveWindow.SmallScroll Down:=9
Range("Rates,Factors_Applied,Our_Cost").Select
Range("Our_Cost").Activate
Selection.Locked = True
'Selection.ReadOnly
Selection.FormulaHidden = False

End Su

--
NeedHelp6
-----------------------------------------------------------------------
NeedHelp69's Profile: http://www.excelforum.com/member.php...fo&userid=3695
View this thread: http://www.excelforum.com/showthread.php?threadid=56679

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default SaveProtect&Close and Lockcells

Do you have an example of how you "put the bottom macro into the top
macro" because there is more than one way and depending on how you do
it depends on the behaviour of some macros
NeedHelp69 wrote:

I have two macros that work fine individually, but I can't seem to put
the Lock Cells one into the protectsaveclose one and get it to work.
What I have is a worksheet where I have a button set up doing the
ProtectSave&Close which managers use and when we want to send it to
people to use, however there are these Ranges where we don't want
people to edit data because they've been abusing this worksheet. So if
I do the locked cells and then manually protect the sheet, save&close,
when I open it up those ranges are still locked, however if I put the
bottom macro into the top macro, either when I re-open the file I can
type into those ranges, or depending where I put it I get a compilier
error that tells me "Unable to set the locked property of the range
class". Any help would be greatly appreciated.




Sub ProtectSaveClose()
'
' ProtectSaveClose Macro
' Macro recorded 3/4/2005 by XXXXX
'

'

Range("A1").Select
Dim wSheet As Worksheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
wSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
End If
Next wSheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
UserForm3.Show
End If
Next wSheet
Application.DisplayAlerts = False
ThisWorkbook.Close savechanges:=True


End Sub


Sub Lock_Cells()
'
' Lock_Cells Macro
' Macro recorded 7/28/2006 by XXXXX
'
' Keyboard Shortcut: Ctrl+c
'
Range("Rates").Select
ActiveWindow.SmallScroll Down:=9
Range("Rates,Factors_Applied,Our_Cost").Select
Range("Our_Cost").Activate
Selection.Locked = True
'Selection.ReadOnly
Selection.FormulaHidden = False

End Sub


--
NeedHelp69
------------------------------------------------------------------------
NeedHelp69's Profile: http://www.excelforum.com/member.php...o&userid=36959
View this thread: http://www.excelforum.com/showthread...hreadid=566794


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SaveProtect&Close and Lockcells


Well I've tryed it a few different ways manually, now both of these ru
however when I open the sheets the cells are no longer locked, maybe
need to use a different code to lock the cells, I don't know?:
Sub ProtectSaveClose()
'
' ProtectSaveClose Macro
' Macro recorded 3/4/2005 by XXXXX
'

'
Range("Rates").Select
ActiveWindow.SmallScroll Down:=9
Range("Rates,Factors_Applied,Our_Cost").Select
Range("Our_Cost").Activate
Selection.Locked = True
'Selection.ReadOnly
Selection.FormulaHidden = False
Range("A1").Select
Dim wSheet As Worksheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
wSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
End If
Next wSheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
UserForm3.Show
End If
Next wSheet
Application.DisplayAlerts = False
ThisWorkbook.Close savechanges:=True


End Sub


and I also tryed:

Sub ProtectSaveClose()
'
' ProtectSaveClose Macro
' Macro recorded 3/4/2005 by XXXXX
'

'
Call SubLockedCells


Range("A1").Select
Dim wSheet As Worksheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
wSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
End If
Next wSheet
For Each wSheet In Worksheets
If wSheet.ProtectContents = False Then
UserForm3.Show
End If
Next wSheet
Application.DisplayAlerts = False
ThisWorkbook.Close savechanges:=True


End Sub


Sub Lock_Cells()
'
' Lock_Cells Macro
' Macro recorded 7/28/2006 by XXXXX
'
' Keyboard Shortcut: Ctrl+c
'
Range("Rates").Select
ActiveWindow.SmallScroll Down:=9
Range("Rates,Factors_Applied,Our_Cost").Select
Range("Our_Cost").Activate
Selection.Locked = True
'Selection.ReadOnly
Selection.FormulaHidden = False

End Su


--
NeedHelp6
-----------------------------------------------------------------------
NeedHelp69's Profile: http://www.excelforum.com/member.php...fo&userid=3695
View this thread: http://www.excelforum.com/showthread.php?threadid=56679

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
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
Not close thead when I close excel wakeup[_3_] Excel Programming 0 December 5th 05 08:57 AM
close button does not close goplayoutside Excel Discussion (Misc queries) 1 October 11th 05 03:42 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM


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

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

About Us

"It's about Microsoft Excel"