![]() |
Protecting a Used Range
My code inserts multiple columns in various places, adds some vlookup and
then selects the used range (which ends up to be Columns A-U, Rows A through 'varies each time'). I'm struggling with how to do the following: 1) Allow the user to enter any data they want outside of the used range (i.e., after the last row/column with an entry. 2) Protect Columns A:J and L:U (and their associated rows) in the used range from any data being entered, but allow the user to enter data anywhere in Column K (including the used range portion). Can anyone please help me with how to do this? |
Protecting a Used Range
Assume we can find the last used row using column A and the used range will
start in A1 Dim lastrow as Long lastrow = cells(rows.count,1).End(xlup).row cells.locked = False Range("A1").Resize(lastrow,21).Locked = True columns(11).Locked = false Activesheet.Protect Password:="secret" -- Regards, Tom Ogilvy "Paige" wrote: My code inserts multiple columns in various places, adds some vlookup and then selects the used range (which ends up to be Columns A-U, Rows A through 'varies each time'). I'm struggling with how to do the following: 1) Allow the user to enter any data they want outside of the used range (i.e., after the last row/column with an entry. 2) Protect Columns A:J and L:U (and their associated rows) in the used range from any data being entered, but allow the user to enter data anywhere in Column K (including the used range portion). Can anyone please help me with how to do this? |
Protecting a Used Range
Thanks, Tom!!
"Tom Ogilvy" wrote: Assume we can find the last used row using column A and the used range will start in A1 Dim lastrow as Long lastrow = cells(rows.count,1).End(xlup).row cells.locked = False Range("A1").Resize(lastrow,21).Locked = True columns(11).Locked = false Activesheet.Protect Password:="secret" -- Regards, Tom Ogilvy "Paige" wrote: My code inserts multiple columns in various places, adds some vlookup and then selects the used range (which ends up to be Columns A-U, Rows A through 'varies each time'). I'm struggling with how to do the following: 1) Allow the user to enter any data they want outside of the used range (i.e., after the last row/column with an entry. 2) Protect Columns A:J and L:U (and their associated rows) in the used range from any data being entered, but allow the user to enter data anywhere in Column K (including the used range portion). Can anyone please help me with how to do this? |
All times are GMT +1. The time now is 03:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com