Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Dynamic Protected Range?

I have a sheet with formatted rows, and each new row with consistent
formatting is added using a macro. I'd like to protect the sheet but
allow the user to edit certain ranges, i.e. the formatted rows. Since
the range that the rows exist changes every time a new row is added,
the user-editable range needs to also change. Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Dynamic Protected Range?

Some code similar to this might help you. But you'd probably want to use it
in the Worksheet_Change() event so that it only actually does something when
the number of rows in your dynamic area changes. How you decide on that is
usually the most complex part of doing something like this.

Sub DynamicUnlocking()
'assumes that the range you want
'to unlock is in column D and
'starts at row 2, you just don't
'know where it ends, it needs to
'end at the last used cell in
'column D
'assumes worksheet is active
Dim unlockRange As Range
Set unlockRange = Range("D2:" & _
Range("D" & Rows.Count).End(xlUp).Address)
ActiveSheet.Unprotect
' may need to use this if sheet has password
'change "sheetpw" to actual password
'ActiveSheet.Unprotect Password:="sheetpw"
'this next command is going to lock ALL
'cells on the sheet
Cells.Locked = True
'now just unlock the ones we
'want unlocked
unlockRange.Locked = False
'put sheet back into protected state
'in order to make your protection scheme work
ActiveSheet.Protect
' may need to use this if sheet has password
'change "sheetpw" to actual password
'ActiveSheet.Protect Password:="sheetpw"

End Sub

"Matt" wrote:

I have a sheet with formatted rows, and each new row with consistent
formatting is added using a macro. I'd like to protect the sheet but
allow the user to edit certain ranges, i.e. the formatted rows. Since
the range that the rows exist changes every time a new row is added,
the user-editable range needs to also change. Is this possible?

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
Dynamic Range (again) Don Excel Discussion (Misc queries) 7 November 26th 08 04:35 PM
Protected Range Not Protected Mike H. Excel Worksheet Functions 2 September 25th 07 03:10 PM
Dynamic Range Sandy Excel Worksheet Functions 3 August 26th 07 04:23 PM
Dynamic Range jlg5454 Charts and Charting in Excel 2 March 8th 06 05:31 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM


All times are GMT +1. The time now is 02:05 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"