Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How can I set a range can't be selected!

I want set a range(one cell or more) can't be selected, so the user can't
change the values. How can I do?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default How can I set a range can't be selected!

Dim MyRange As Range

Set MyRange = Worksheets("Sheet1").Range("B3:D20")
Set MyRange = Activesheet.Range("A10")
Get the idea?

Mike F
"cherishman" wrote in message
...
I want set a range(one cell or more) can't be selected, so the user can't
change the values. How can I do?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default How can I set a range can't be selected!

You can lock those cells (as well as any other cells that shouldn't be changed)
and unlock the cells that are ok to update.

Format|Cells|protection tab
is one way of toggling that setting.

Then protect the worksheet.
tools|protection|protect sheet

Be aware that worksheet protection isn't a security measure--it's usually just
used to keep users from overwriting formulas/labels.

That worksheet protection is easily broken.

And if you really want to stop the selection--not just stop the changing...

If you protect the sheet in code, it'll work for xl97+ (as long as the macro
runs):

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi"
.EnableSelection = xlUnlockedCells
End With
End Sub

Excel won't remember these settings after you close it and reopen the workbook
(that's why it's in auto_open).

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

cherishman wrote:

I want set a range(one cell or more) can't be selected, so the user can't
change the values. How can I do?


--

Dave Peterson
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
how to add 130% to a selected range of numbers ? MATHIMATICALLY IMPAIRED Excel Discussion (Misc queries) 4 January 14th 09 05:22 PM
Reclaculating a selected range [email protected] Excel Discussion (Misc queries) 3 March 23rd 06 08:43 AM
delete every nth row in selected range cwinters Excel Discussion (Misc queries) 1 July 6th 05 08:17 PM
Copying a selected used range michael Excel Programming 1 September 24th 03 02:49 PM
Box around selected range Tom Ogilvy Excel Programming 1 September 7th 03 04:42 PM


All times are GMT +1. The time now is 01:47 PM.

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"