Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Locking certain cells

I have a spreadsheet that as a group of 5 columns grouped together using the
DATA - GROUP option - I want to protect the first colum from entry and allow
figures to be inputted into the other 4 columns - I can do this if I dont
mind seeing all the other columns but I want to collapse them as necessary
but if I protect the relevant cells and then Protect the Sheet it wont let me
collapse the group. Is it possible?

Thanks
Beverly
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Locking certain cells

If you already have the outline/subtotals/autofilter applied, you can protect
the worksheet in code (auto_open/workbook_open??).

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
'.EnableAutoFilter = True
'If .FilterMode Then
' .ShowAllData
'End If
End With
End Sub

It needs to be reset each time you open the workbook. (Earlier versions of
excel don't remember it after closing the workbook. IIRC, xl2002+ will remember
the allow autofilter setting under tools|Protection|protect sheet, but that
won't help when you're filtering via code.)

Beverly Darvill wrote:

I have a spreadsheet that as a group of 5 columns grouped together using the
DATA - GROUP option - I want to protect the first colum from entry and allow
figures to be inputted into the other 4 columns - I can do this if I dont
mind seeing all the other columns but I want to collapse them as necessary
but if I protect the relevant cells and then Protect the Sheet it wont let me
collapse the group. Is it possible?

Thanks
Beverly


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Locking certain cells

Dave

do I put this code in as a macro after I protected the cells I want
protected? And how would I reset it each time - sorry to ask such silly
questions but this is outside of my use of excel.

thanks

Beverly

"Dave Peterson" wrote:

If you already have the outline/subtotals/autofilter applied, you can protect
the worksheet in code (auto_open/workbook_open??).

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
'.EnableAutoFilter = True
'If .FilterMode Then
' .ShowAllData
'End If
End With
End Sub

It needs to be reset each time you open the workbook. (Earlier versions of
excel don't remember it after closing the workbook. IIRC, xl2002+ will remember
the allow autofilter setting under tools|Protection|protect sheet, but that
won't help when you're filtering via code.)

Beverly Darvill wrote:

I have a spreadsheet that as a group of 5 columns grouped together using the
DATA - GROUP option - I want to protect the first colum from entry and allow
figures to be inputted into the other 4 columns - I can do this if I dont
mind seeing all the other columns but I want to collapse them as necessary
but if I protect the relevant cells and then Protect the Sheet it wont let me
collapse the group. Is it possible?

Thanks
Beverly


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Locking certain cells

You can put the code in anytime you want <bg, but you have to put it in a
certain spot. Put it in a general module (Insert|Module when you're in the
VBE).

But this code has to run each time the workbook is opened. It's not one of
those run once and forget about it. So that means that you (and your users)
have to allow macros to run each time the workbook is opened.

After you've put the code in, you can save the file (as a new name if you're
unsure) and then close and reopen that file. The Auto_Open procedure should run
(if your security settings are ok--and you allow macros to run).
Then you can test showing/hiding rows.

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

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side.

Paste the code in there.

Then alt-f11 (to get back to excel), close and save the workbook. Then
File|Open the newly saved workbook.

Did it work???

Beverly Darvill wrote:

Dave

do I put this code in as a macro after I protected the cells I want
protected? And how would I reset it each time - sorry to ask such silly
questions but this is outside of my use of excel.

thanks

Beverly

"Dave Peterson" wrote:

If you already have the outline/subtotals/autofilter applied, you can protect
the worksheet in code (auto_open/workbook_open??).

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
'.EnableAutoFilter = True
'If .FilterMode Then
' .ShowAllData
'End If
End With
End Sub

It needs to be reset each time you open the workbook. (Earlier versions of
excel don't remember it after closing the workbook. IIRC, xl2002+ will remember
the allow autofilter setting under tools|Protection|protect sheet, but that
won't help when you're filtering via code.)

Beverly Darvill wrote:

I have a spreadsheet that as a group of 5 columns grouped together using the
DATA - GROUP option - I want to protect the first colum from entry and allow
figures to be inputted into the other 4 columns - I can do this if I dont
mind seeing all the other columns but I want to collapse them as necessary
but if I protect the relevant cells and then Protect the Sheet it wont let me
collapse the group. Is it possible?

Thanks
Beverly


--

Dave Peterson


--

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
Locking Cells Jai Excel Discussion (Misc queries) 5 October 8th 09 01:25 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking Cells rob8278 Excel Worksheet Functions 0 May 12th 05 07:56 PM
Locking Cells WendiW Excel Discussion (Misc queries) 1 March 10th 05 08:15 PM
Locking certain cells Marvin Excel Worksheet Functions 1 December 7th 04 07:13 PM


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