Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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?

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
Protecting the Print Range. becky Excel Discussion (Misc queries) 3 April 30th 09 06:05 PM
Protecting a Range of Specific Cell/s Blacksmith[_2_] Excel Discussion (Misc queries) 1 August 27th 07 04:43 PM
Protecting a Range of Specific Cell/s Blacksmith[_2_] Setting up and Configuration of Excel 1 August 27th 07 04:43 PM
Protecting Range Names Frederick Chow Excel Discussion (Misc queries) 4 March 8th 06 12:09 PM
Protecting Formulas from a range from being viewed Andrew Heath Excel Discussion (Misc queries) 4 October 12th 05 03:14 PM


All times are GMT +1. The time now is 09:41 PM.

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"