Hiding Protecting Sheets After Someone Clicks On Cell
Jan 5, 2013
I have a sheet that pulls data from an external source. I want it so that when a person clicks on a cell or a range of cells, it automatically locks and hides the formula. I don't want to lock it by using the conventional method because protecting it will cause the external data not to be able to populate the cells. So my thinking is that when the data is imported, and the user clicks on a cell, it will automatically lock and hide.
I need columns
A C E:BB to be locked and hidden as soon as someone clicks it. Is this possible?
I read somewhere that I may be able to do some type of "Private Sub Workbook_SheetSelectionChange" to achieve this.
on sheet1 I have a button I need to do the following when clicked: (1) name the next 30 sheets based on cell values in sheet1 (2) for those 30 sheets, hide some of them based on a y/n input in sheet 1
To clarify: the worksheets do not need to be created, they already exist. They just need to be renamed and hidden based on that y/n criteria. see attachment with just 1 worksheet for clarification. So - The next 30 sheets are to be named by the following ranges (B7:B16), (B21:B30) and (B35:B44). For every product with a "n" in column C of sheet1, the worksheet for that product needs to be hidden.
I have a workbook that has about 30 different sheets with names titled "Joe", "Jane", "Paul", etc.
I have a Cell (B12) that has been formatted as a dropdown menu with about a dozen different options such as "Audit A" , "Audit B" or "Other" etc. What i'd like to do is hide or display certain sheets based on what the value is in cell B12.
if cell B12 says any of the following "Audit A" or "Audit B" then it would hide certain sheets. If the value in B12 says "Other" or something other than "Audit A" or "Audit B" then it wouldn't hide anything at all. I tried searching and couldn't find anything like this although it may have been answered before.
I am trying to find code that will allow me to hide a set number of rows based on the value of a specific cell which I need to work for two worksheets in the same workbook. Is that even possible?
For example: when i enter 5 into cell D1, I need five rows to be visible on both sheets.
I am trying to protect all sheets on a Workbook Close event.
I don't want the user to even be able to Select the Loked cells so I set it up that way through formating of cells.
This is what I have tried:
Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim sh As Worksheet For Each sh In ThisWorkbook.Worksheets sh.Protect Password:="P@ssword", DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.EnableSelection = xlUnlockedCells ' sh.Protect Password:="P@ssword" Next sh End Sub I even tried the commented out line in that postion instead of where it is now.
It does protect but still allows selection of locked cells.
I currently have set up two macros that will unprotect and protect all sheets. When I run the macro I noticed that it will not unprotect the sheets that have been set as a new sheet for the chart (the chart is not a object in a sheet it is a sheet all by itself) Can anyone tell me where I have gone wrong?
Private Sub Worksheet_Activate() ActiveWindow.WindowState = xlMinimized If InputBox("Pleas enter the password: ") "Password" Then Sheets("OkToSeeThisOne").Activate ActiveWindow.WindowState = xlMaximized End Sub This is the code i enter into 3 sheets that i don't want ppl to see unless they know the password but if they press cancel the End on the debug error they can view the sheet lolz. How can i stop them actually viewing it at all?
The code changes the cell color depending on how many clicks you give it. The code it self works fantastic but the problem i have is if i manually unlock the sheet every time i click any where in sheet it locks it again.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo Error Dim I As Integer, I1 As Integer, ws1 As Worksheet
Set ws1 = Worksheets("36hr Plan") ws1.Unprotect "muppeticity"
I1 = 40 For I = 5 To 25 Step 5 For I1 = 22 To 204 Step 13 Offset1 = 0 If Not Intersect(Target, ws1.Cells(I1, I)) Is Nothing _ Or Not Intersect(Target, ws1.Cells(I1 + 1, 5)) Is Nothing _ Or Not Intersect(Target, ws1.Cells(I1 + 2, 5)) Is Nothing Then.............
Is there a way of counting mouse clicks on an active XL cell and displaying the real time count in the cell, in essence giving a click count? Or in the case of a handheld, tapping an active cell and having the value incrementally increase with each tap...
I am using some VBA I found here to password protect a hidden sheet. It works perfectly for 1 sheet, but I am trying to hide 6 but am having problems. Under the HideSheets part I've modified it fine, by using
Sub HideSheets() 'Set worksheet to Very Hidden so that it can only be unhidden by a macro Worksheets("Confidential1").Visible = xlSheetVeryHidden Worksheets("Confidential2").Visible = xlSheetVeryHidden Worksheets("Confidential3").Visible = xlSheetVeryHidden End Sub.........
I have a user form that has 12 check boxes corresponding to the months on the year. All or none of the check boxes can be ticked at the same time. How can I get the value of the check boxs to one cell on the worksheet.
ie. Check boxes 'Jan', 'Feb', 'June' and 'Oct' are ticked. On the worksheet, cell A1 would say 'Months chosen: Jan, Feb, June, Oct'
I have a large workbook with 10+ sheets i need to protect all at once. I have created a macro in VBA below. It works, but I would like another user to be able to change formatting on the sheets while they are protected. below is my macro.
Sub ProtectAll() Dim wSheet As Worksheet Dim Pwd As String
A workbook with 7 sheets in it. The first sheet contains buttons with macros that when clicked will navigate you to different sheets in the workbook based on what button you click. Here's what I want to do. When the workbook is opened, I want it open to that first sheet with the buttons, but show no other tabs for the other sheets at the bottom. And then when that button is clicked on the first sheet to go to a different page, I want that page to be the only visible tab in the workbook with the rest still hidden. Is that doable? I already have the buttons and codes and everything for the navigation part down, I just need to have the other hidden when I'm on a different sheet.
Sub Button10_click() Worksheets("Account Type").Activate End Sub Sub Button11_Click() Worksheets("Name Change").Activate End Sub Sub Button12_Click() Worksheets("Address-Phone").Activate End Sub Sub Button13_Click() Worksheets("Main Menu").Activate End Sub Sub Button15_Click() Worksheets("Cust-Owner").Activate End Sub Sub Button16_Click() Worksheets("Misc").Activate End Sub
I wanted to know if there is any function/macro/option available which can hide/show sheets based on the value selected in the particular cell.
Basically i will have a table of contents as the first sheet. Post that if 'Yes' is selected against a particular line item, the sheet for the same should appear. If 'no' is selected the sheet would remain hidden. The sheets would be linked via hyperlink to the particulars (name) for each line of the table of contents. If required i can also remove the hyperlinking of cell.
I wrote a macro that hides every row that contains an "X" in column X for every sheet. The problem is that it runs very slowly (assumedly because it is checking every cell on every sheet). Is there a way to clean this up and make it run faster?
My code: Sub HideRows() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets Dim Cell As Range For Each Cell In ws.Range("X:X") If Cell.Value = "X" Then Cell.EntireRow.Hidden = True End If Next Next ws End Sub
As many are aware, there is an option to make a sheet very hidden. However, a "very hidden" sheet remains visible in the VBE project window. A user with basic VBA knowledge can easily selected the hidden sheet & go in the property window and change its visibility setting to "-1 Sheetvisible". Is there any way to make hidden sheet invisible in VBE as well?
i have a list of services with "yes" or "no" options in the column beside it. Description for each service is given on separate sheets (Workbook sheet 1, Workbook sheet 2..etc). i want to format it in a way that if i choose "no" for one of the services, its description sheet hides.
I have a worksheet that veryhides all the sheets but one when closes and when opens if unhides the ones a user needs. For some reason the quick key Alt + PageUp or Alt + PageDown doesn't work until each sheet is scrolled through by clicking on their tab with the mouse.
where # equals the exact cell in the other sheet I want to copy. I'm also starting to realize that with this formula, Senior Monkette and I could take Dingleberry and Bliddiboo and combine them into a more powerful and robust spreadsheet (called "Voltron!").
1. If we're going to be sending Voltron! to the client, all I would need to do is password protect, then hide the Dingleberry sheets so that the client doesn't look at them accidentally, right?
2. If I hide and protect the Dingleberry sheets, the cell information will still show up on the Bliddiboo sheet, right?
3. Since Senior Monkette isn't as Excel-savvy as I am, the entire process would have to be as painless as possible. What I was thinking of doing was having one master Voltron! where Senior Monkette could make her changes and updated. Then every week, save the entire thing, protect/hide the Dingleberry sheets, and then save a copy as a separate Voltron! file, marked by the date, which then gets shipped off to the client. Is there a macro I can run that will do that all with the press of one button? (And how do I install macros?)
I have an activeX combo-box that selects from different pieces of equipment that we supply. Based on that selection, I require ranges from the same page that the combo-box is on to either hide or unhide. Also, I require different tabs to become visible or hidden based on that same selection. So far so good - I have code that does this, and it appears to work without glitch.
Where the problem arises, is in one of the ranges that is unhidden when a particular piece of equipment is selected there is another combo-box that I would like to use (the number of said pieces of equipment to supply) to further hide/unhide additional ranges on the same page, and also hide/unhide certain tabs as well.
When I make a selection from combo-box 1, all works as planned, but when I change the state of combo-box 2, even with no associated coding referring to it, I cannot change combo-box 1 again without getting Error 1004 "Unable to get the Hidden property of the range class".
None of the sheets in the workbook are protected.
I would sincerely appreciate any help/code that could circumvent this error.
I have groups of data in A5:AW200 with various blank rows in between, and would like to be able to automatically hide and unhide (toggle) the blank rows, but only for those rows where cells in column A are blank.
I'd also like to hide those same groups of blank rows on Sheets 2-5, which are laid out exactly the same as Sheet 1, but since they contain cell references to and are mirrors of Sheet 1, certain rows on those sheets may appear blank, but in fact are not. (I should probably have separate buttons on each sheet, but not sure). I know Sheet 1 can be used to test for conditions (blanks rows) and translate the results to Sheets 2-5, but I'm not sure how to do it.
I am using Reafidy nice bit of code to hide worksheets if the user disables macros. The problem, though, is that it doesn't work for Chart Worksheets. How should I adjust this to accommodate charts?
Private Sub Workbook_BeforeClose(Cancel As Boolean) bIsClosing = True End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim wsArray() As Variant Dim iCnt As Integer Application. ScreenUpdating = 0
I have a spreadsheet which has 3 separate external queries running from worksheet 'A'. My user enters a couple of dates in another worksheet 'B' to supply the date parameters for the query and a macro runs to refresh all of the queries and performs a few calculations.This works fine. The trouble is I don't want the user to be able to view all the data on sheet 'A' only the summary on B. My macro ends up on sheet B but whilst the query is refreshing the raw data is displayed to the user on sheet 'A'. When I hide the sheet 'A' i get a run time error '1004' Select method of worksheet class failed.
I have a workbook with the following sheets i do not want to hide called "Detailed Template", "INTERFACES", "STATUS".
I then have a number of worksheets which have their names as cell addresses i.e. "E4", "E5", "D4", "F4", "G7" and so on.
I would like to hide all worksheets (except the 3 mentioned at the top [which are sheets 1-3]) and any which contain say the value of '4'. This value is defined by a cell in the "INTERFACES" worksheet say 'A1' for example.
I want the macro to be able to automatically do this for which ever value is in 'A1'. So if it were to change to '7' it would hide every sheet that doesn't contain '7' in the name.