Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a question about a previous code I saw for maintaining outlines in a
protected worksheet. DP, if you read this, need your help - the code was one you posted for someone. Before the code, your wrotes: If you already have the outline applied, you can protect the worksheet in code (auto_open/workbook_open??) - What does this mean? The code is as follows: Option Explicit Sub auto_open() With Worksheets("sheet1") .Protect Password:="hi", userinterfaceonly:=True .EnableOutlining = True .EnableAutoFilter = True End With End Sub At the end, you also add that it needs to be reset each time, what too does that mean? Two other small questions 1.) - what is the code doing exactly (I just need to understand what it says in simple terms which helps me understand and change the code if necessary) 2.)And two, everytime I paste it, the "Option Explicit" always pastes separately. Should I be pasting this under View code on worksheet or somewhere else? (I admit, my programming knowledge is limited but I can understand if it's explained) Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
It means that you can't do what you want manually. You have to use code to make
it work the way you want. And this is a setting that excel won't remember tomorrow if you set it today. You have to reset it each time you open that file. ======== #1. It looks at Sheet1 (change that to match your sheet name). It protects the sheet using a password--I used "hi", change it to match your password. The ..enableoutlining enables the outlining feature. The .enableautofilter will enable you to use the filter arrows. But both of these have to be applied before the code runs--you can't add data|filter or Data|group with the worksheet protected. You apply those manually (usually). #2. This code doesn't go behind a worksheet or behind ThisWorkbook. It goes into a general module. Option explicit is the way developers tell excel that they are going to be declaring every variable that they use. That should be used once (per module) and it should appear at the top of the module. Chiku wrote: I have a question about a previous code I saw for maintaining outlines in a protected worksheet. DP, if you read this, need your help - the code was one you posted for someone. Before the code, your wrotes: If you already have the outline applied, you can protect the worksheet in code (auto_open/workbook_open??) - What does this mean? The code is as follows: Option Explicit Sub auto_open() With Worksheets("sheet1") .Protect Password:="hi", userinterfaceonly:=True .EnableOutlining = True .EnableAutoFilter = True End With End Sub At the end, you also add that it needs to be reset each time, what too does that mean? Two other small questions 1.) - what is the code doing exactly (I just need to understand what it says in simple terms which helps me understand and change the code if necessary) 2.)And two, everytime I paste it, the "Option Explicit" always pastes separately. Should I be pasting this under View code on worksheet or somewhere else? (I admit, my programming knowledge is limited but I can understand if it's explained) Thanks in advance. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave, you explain even technical stuff very well - THANK YOU!!!! At this
rate, I will become a programmer :) Thanks a lot, I will try and avoid doing programming stuff coz that is how I am getting stuck, but you do explain things so well that it is easy for non-programmer like me to figure out. Thank you!!!! "Dave Peterson" wrote: It means that you can't do what you want manually. You have to use code to make it work the way you want. And this is a setting that excel won't remember tomorrow if you set it today. You have to reset it each time you open that file. ======== #1. It looks at Sheet1 (change that to match your sheet name). It protects the sheet using a password--I used "hi", change it to match your password. The ..enableoutlining enables the outlining feature. The .enableautofilter will enable you to use the filter arrows. But both of these have to be applied before the code runs--you can't add data|filter or Data|group with the worksheet protected. You apply those manually (usually). #2. This code doesn't go behind a worksheet or behind ThisWorkbook. It goes into a general module. Option explicit is the way developers tell excel that they are going to be declaring every variable that they use. That should be used once (per module) and it should appear at the top of the module. Chiku wrote: I have a question about a previous code I saw for maintaining outlines in a protected worksheet. DP, if you read this, need your help - the code was one you posted for someone. Before the code, your wrotes: If you already have the outline applied, you can protect the worksheet in code (auto_open/workbook_open??) - What does this mean? The code is as follows: Option Explicit Sub auto_open() With Worksheets("sheet1") .Protect Password:="hi", userinterfaceonly:=True .EnableOutlining = True .EnableAutoFilter = True End With End Sub At the end, you also add that it needs to be reset each time, what too does that mean? Two other small questions 1.) - what is the code doing exactly (I just need to understand what it says in simple terms which helps me understand and change the code if necessary) 2.)And two, everytime I paste it, the "Option Explicit" always pastes separately. Should I be pasting this under View code on worksheet or somewhere else? (I admit, my programming knowledge is limited but I can understand if it's explained) Thanks in advance. -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Glad I could help.
But the best way to learn (I think) is to struggle with it. I wouldn't give up. There's just so much more you can do with a little code that makes life much easier. Chiku wrote: Dave, you explain even technical stuff very well - THANK YOU!!!! At this rate, I will become a programmer :) Thanks a lot, I will try and avoid doing programming stuff coz that is how I am getting stuck, but you do explain things so well that it is easy for non-programmer like me to figure out. Thank you!!!! "Dave Peterson" wrote: It means that you can't do what you want manually. You have to use code to make it work the way you want. And this is a setting that excel won't remember tomorrow if you set it today. You have to reset it each time you open that file. ======== #1. It looks at Sheet1 (change that to match your sheet name). It protects the sheet using a password--I used "hi", change it to match your password. The ..enableoutlining enables the outlining feature. The .enableautofilter will enable you to use the filter arrows. But both of these have to be applied before the code runs--you can't add data|filter or Data|group with the worksheet protected. You apply those manually (usually). #2. This code doesn't go behind a worksheet or behind ThisWorkbook. It goes into a general module. Option explicit is the way developers tell excel that they are going to be declaring every variable that they use. That should be used once (per module) and it should appear at the top of the module. Chiku wrote: I have a question about a previous code I saw for maintaining outlines in a protected worksheet. DP, if you read this, need your help - the code was one you posted for someone. Before the code, your wrotes: If you already have the outline applied, you can protect the worksheet in code (auto_open/workbook_open??) - What does this mean? The code is as follows: Option Explicit Sub auto_open() With Worksheets("sheet1") .Protect Password:="hi", userinterfaceonly:=True .EnableOutlining = True .EnableAutoFilter = True End With End Sub At the end, you also add that it needs to be reset each time, what too does that mean? Two other small questions 1.) - what is the code doing exactly (I just need to understand what it says in simple terms which helps me understand and change the code if necessary) 2.)And two, everytime I paste it, the "Option Explicit" always pastes separately. Should I be pasting this under View code on worksheet or somewhere else? (I admit, my programming knowledge is limited but I can understand if it's explained) Thanks in advance. -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protected Sheet Message | Excel Discussion (Misc queries) | |||
Applying autofilter to protected sheet | Excel Discussion (Misc queries) | |||
How to copy/paste info into the protected sheet | Excel Discussion (Misc queries) | |||
Copying multiple sheets from one book 2 another and undertake spec | Excel Discussion (Misc queries) | |||
Unlock a spinner or scrollbar on a protected sheet | Excel Worksheet Functions |