VBA Across Sheets Reference And Row Hide?
Jan 11, 2012
Im working across Multiple Sheets and trying to get the following working.
I want a an input by the user of "NO" in cell M11 on Sheet 1 of my workbook to hide rows 32 - 41 on Sheet 2 and not to hide them if the user keys in "YES"
View 9 Replies
ADVERTISEMENT
Jul 15, 2013
I am trying to figure out a code where hides all sheets in "ThisWorkbook" veryhidden except the ones names "Template" and "Report" and "Product"
I tried with the code below but the debugger stops at the line highlighted in red. perhaps i am missing something in the code.
Code:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("rReport").Value = "" Then
Cancel = True
[Code] .........
View 8 Replies
View Related
Apr 19, 2013
I have a combobox that I want visible only if a certain cell has a specific value. Otherwise it remains hidden.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("Set Range Value").Value = "Set Desired Value" Then
ActiveSheet.Shapes("ComboBoxName").Visible = False
Else
ActiveSheet.Shapes("ComboBoxName").Visible = True
End If
End Sub
This is a Control Tool ComboBox as I'm sure that will make a difference.
View 2 Replies
View Related
Apr 22, 2009
How can I automatically hide rows based on a cell reference? For example, If A1=0 then hide row 1.
View 9 Replies
View Related
Oct 15, 2008
I am trying to get a code that will Hide ALL sheets (xlVeryHidden) except for "Meeting Minutes" and "Index"
I want to do it 2 ways.
1) User Click a button and it happens
2) Upon Exiting the Workbook it happens
I tried modifying a code that I had to Reveal sheets but I can get it to operate the other way:
Sub HideMINUTESandMASTER()
Dim Sh As Worksheet
If Sheets("Meeting Minutes").Visible = True Then
End If
If Sheets("Index").Visible = True Then
End If
For Each Sh In Worksheets
Sh.Visible = xlVeryHidden
Next Sh
Sheets("Meeting Minutes").Select
Range("C1").Select
End Sub
View 9 Replies
View Related
Feb 20, 2014
I have a workbook with about 20 worksheets in it.
6 are visible
3 are hidden
the remaining are very hidden
I'm creating a "welcome" page to the workbook with instructions on how to update data. The data between the 20 sheets consists of pivot tables, charts and summary data. The Visible sheets are data for management's review (all protected). The 3 hidden sheets are pivot tables that the user needs to pull data from and the very hidden sheets are not to be seen by anyone.
In my "welcome" page, I added the instructions of how to update data, but wanted an area where I could assign a checkbox or button to click on for the user to unhide my 3 hidden sheets (say Sheet1, Sheet2 and Sheet3). I do not want it to unhide my very hidden sheets. Then, when the information needed is retrieved from those sheets, I would like the user to use a checkbox or button to hide the 3 hidden sheets again. Is there a way to do this?
I tried creating custom view but couldn't do that because of the pivot tables (the option was disabled). I'm a beginner in VBA so don't even know how to begin.
View 6 Replies
View Related
Nov 23, 2009
I have a workbook w/ 120+ sheets, and the first one is a table of contents, while each following sheet is a record sheet for one of 10 individuals. That is, sheets 2-8 are for Alice, 9-12 for Bob, 13-29 for Charles, etc. Individual names are in column C, sheet names are hyperlinked text in column A on the table of contents sheet.
I want to know how to hide all the sheets which are not meant for the individual based on the autofilter of Column C. If I select Alice as the autofilter criteria for Column C, I want all the sheets except the table of contents and her sheets 2-8 to be hidden.
View 14 Replies
View Related
Oct 19, 2012
I have a workbook where each sheet is password protected. I'm trying to find some code that would unprotect each sheet, and hide rows 1-12 on each sheet, and then re-protect all sheets.
View 4 Replies
View Related
Jul 19, 2008
I would like to hide all worksheets and chartsheets in a workbook. I use
For Each sh In Sheets
sh.Visible = xlSheetVisible
Next sh
but I think it breaks down for chart sheets. Any solutions?
View 9 Replies
View Related
Feb 22, 2007
I need to hide all sheets appart from one sheet.
View 4 Replies
View Related
Oct 24, 2007
I would like to have all my worksheets except one hidden when a user saves the workbook. I can do it with a macro but not all users use the macro to save the document and sheets are left visible.
View 3 Replies
View Related
Aug 14, 2007
how to get a workbook containing macros to save as an addin xla format to include hidden worksheets?
I have referenced them in the code, in unhides, copies as a new sheet and then rehides it.
Yet when I run it as an addin, when it goes to unide the sheet, it says Im referencing something which doesn't exist (because it's not included in the xla addin).
View 4 Replies
View Related
Aug 2, 2014
continued from: [URL]
Option Explicit forces explicit declaration of all variables in the code. That is why i had to declare ws as worksheet using the Dim statement before using it in the code. It is recommended to have it - however for this code it wouldn't have mattered.
I'm not sure I exactly follow what you imply here. But yes, you can hide all the sheets at first and then "unhide" at the start of the macro. Let's say you have a "Start" sheet.. then:
[Code] .....
The workbook is used by other people too. I cannot just tell them to hide the sheets, it defeats the purpose. What I want is, when macro is disabled, they will only see the START sheet, otherwise, all sheets will be visible. To add to this, a new sheet is added everyday. Sheets name are calendar dates in mmdd format
View 4 Replies
View Related
Mar 8, 2014
I'm trying to only show specific sheets per user using the environ variable and this code seems to work for the single user / sheet but the master user does not function correctly i.e. the code does not show all sheets, this is the code I am using:
[Code] ......
Why the above code does not respect the Master User "Jane" should be able to see all sheets?
Original source for this code was found here:
HTML Code: [URL]....
View 7 Replies
View Related
Nov 6, 2008
I want to run 2 different macros:
Macro 1- hides Sheet1 and unhides Sheet2
Macro 2- Hides Sheet2 and unhides Sheet1
I used the macro recorder to attempt to make this work but am running into a problem if Macro1 is run two times consecutively. In this situation the macro displays a debugging error b/c Sheet1 is hidden. Is there a way to get around this...possibly using an if then statement?
View 6 Replies
View Related
Dec 3, 2011
I have these following codes. when i click button then it updates the records, like pulling data from sheets and putting it into one. thats working fine. only things is, when it update the records, then it shows whats going on behind, all updating sheets get visiable. is it possible can i just hide whats going on in the back? when i click the button msg box comes up that please wait its updating the record.
Dim Response As Integer
MsgStr = "ARE YOU SURE YOU WANT TO UPLOAD NOW?, PLEASE CONSIDER RE-CHECKING YOU INPUT!!"
TitleStr = "USER MESSAGE"
If MsgBox(MsgStr, vbYesNo, TitleStr) = vbYes Then
Sheets("Employee Data Input").Select
[Code] ...........
View 4 Replies
View Related
Apr 3, 2013
Heres My Code...
Code:
Sub HideDatedSheets()
Dim wb As Workbook
Dim ws As Worksheet
Dim dDate As Date
[Code]...
So what im trying to do is keep the Union* sheets shown as well as the Report* sheets shown. But i believe i have the code wrong because they are not showing up when the work book opens...
Trim(ws.Name) = "Union*" Or _
Trim(ws.Name) = "Report*" Or _
View 4 Replies
View Related
Jun 6, 2013
Let's say I have Sheet1-Sheet6. I also have combobox1 (with item 1, 2, & 3 as the list items) & combobox 2 (with items 1 & 2 as the list items).
If combobox1 = 1 & combobox2 = 1 then hide Sheets 2,3,4,5,6
if combobox1 = 1 & combobox2 = 2 then hide Sheets 1,2,4,5,6
If combobox1 = 1 & combobox2 = 3 then hide sheets 1,2,3,4,6
If combobox1 = 2 & combobox2 = 1 then hide sheets 1,3,4,5,6
If combobox1 = 2 & combobox2 = 2 then hide sheets 1,2,3,5,6
If combobox1 = 2 & combobox2 = 3 then hide sheets 1,2,3,4,5
I would like to also make both of these combo boxes required fields and to default text to say 'Select One...'
View 1 Replies
View Related
Mar 10, 2014
What would be the macro if i need to hide multiple select sheets? I'm working on a test with 12 sheets. Even number sheets contains the fields that they need to answer and the Odd number sheets contains the formula for score computing including the answers so it needs to be like this:
Sheet 2 - The test
Sheet 3 - Must be hidden
Sheet 4 - The test
Sheet 5- Must be hidden
Sheet 6- The test
Sheet 7 - Must be hidden
I already have the code to unhide all sheets, just need the macro to hide specific sheets like the ones above.
View 2 Replies
View Related
Mar 23, 2014
Here is what I think I want to do (however there may be a better way to get to the end result).
Macro 1:
Unhide all worksheets however, first list only the worksheets that are visible.
Macro 2:
I want to be able to hide all worksheets except those in the above list.
My intent would be to have these in the personal file so I could run either process on any file I have open so I think I would need to insert a tab for the list when unhiding & remove the tab after hiding.
I have found many strings unhiding all & hiding all except a named sheet... but can't find anything on the above?
View 2 Replies
View Related
Jun 3, 2014
I have a workbook that I edit daily then pass along to another team. All of my modules are passwork protected and there are also several sheets in the workbook that I hide before email it to the other team. I hide the sheets by changing the sheet properties in the VBA editor to "2 - xlSheetveryhidden".
This isn't a very time consuming process but I am wondering if there is a way to automate it through VBA?
I tried the the fail safe of "see what happens when I record it" but all I got was an empty Module.
View 2 Replies
View Related
Jun 18, 2014
I developed some pivot table reports and macro'd out pdf'ing them for the users but now management want the users to be able to manipulate the data themselves !! The file is 31 sheets and I'm figuring they'll only want to see the sheets that are relevant to them so is there a way to macro it out?? Perhaps when the file opens it asks, "Who do you want to see?" Jack? Joe? or Rudy?, Month or YTD, or Both? or Everything? and it will hide the sheets that are not selected. The words "month" and "YTD" is in Cell "N1" and the individuals names are in Cell "M1".
View 6 Replies
View Related
Feb 28, 2007
I wanted to force the user to "enable macros." Searching online brought me to the method of hiding all sheets but one and only un-hiding the important sheets if the user accepts macros. This is done with event procedures as shown below ( I stole this code from a webpage and only added unprotect/protect workbook and made the Hideall and Showall subs private also since I don't want the user to have any idea what's going on):
The code below starting with BEGIN works but my problem is I need to add some additional stuff to the WorkBook_BeforeClose procedure. What I added to the BeforeClose procedure is a series of IF statements that follow this form:
If IsEmpty(Range("C9").Value) = True Then
MsgBox "Please enter data in this Cell C9", vbExclamation + vbOKOnly, "Validation"
Cancel = True
End if
The problem occurs if the User attempts to close without entering the required data. This will correctly trigger the above IF statements as desired. However, after Canceling, if the user decides to Save (without closing, by say clicking the floppy disk button in the upper left), then "HideAll" is executed which I do not want. I assume this is because bIsClosing has been set to TRUE and was never reset after the IF statements triggered a Cancel? Is this correct? How can I fix this? I tried adding a bIsClosing = False line at the end of every IF statement, but I think that just made things more screwy.
BEGIN
Private Sub Workbook_BeforeClose(Cancel As Boolean)
bIsClosing = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Cancel = True Or bIsClosing = False Then Exit Sub
Run "HideAll"........................
View 9 Replies
View Related
Sep 29, 2008
I have 16 sheets and 4 additional sheets that will kind of 'Group' these 16sheets. For example: I have 'Sheet1', 'Sheet2', 'Sheet3'......, 'Sheet16'.
4 additional Sheets are: 'Group1', 'Group2', 'Group3', 'Group4'.
I need a help with macro so that when this workbook is open all 20 sheets ('Sheet1', 'Sheet2', 'Sheet3'......, 'Sheet16') will go into hiding and only 4 additional Sheets ('Group1', 'Group2', 'Group3', 'Group4') will be visible. Now, these 4 sheets will have the command button links to the following sheets:
Sheet 'Group1':'Sheet1', 'Sheet2', 'Sheet3', 'Sheet4', 'Hide All'
Sheet 'Group2':'Sheet5', 'Sheet6', 'Sheet7', 'Sheet8', 'Hide All'
Sheet 'Group3':'Sheet9', 'Sheet10', 'Sheet11', 'Sheet12', 'Hide All'
Sheet 'Group4':'Sheet13', 'Sheet14', 'Sheet15', 'Sheet16', 'Hide All'
This being said, when you click on each command buttons, the respective sheets will open up and when click on 'Hide All', all of the open sheets for that *additional sheet' for example sheet 'Group1' will go into hiding again.
View 9 Replies
View Related
Oct 6, 2008
See I have hidden my sheets and I need them to stay hidden.
But when I need to unhide them, a password should be needed to unhide them.
Maybe add a button on one of the open sheets that when pressed will unhide the sheets but will promt for password.
View 9 Replies
View Related
Jan 16, 2010
1) Force user to enable macros.
2) keep three worksheets very hidden all the time.
3) passwrd protect vba
I have been using this code to force user to enable macros but this unhides all sheets other than "macros not enabled" sheet. I need three worksheets to remain very hidden all the time. How do I do this.
Option Explicit
Dim ws As Worksheet
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Worksheets("Macros Not Enabled").Visible = True
For Each ws In Worksheets
If ws.Name "Macros Not Enabled" Then ws.Visible = xlVeryHidden
Next
End Sub
Private Sub Workbook_Open()
For Each ws In Worksheets
If ws.Name "Macros Not Enabled" Then ws.Visible = True
Next
Worksheets("Macros Not Enabled").Visible = xlVeryHidden
End Sub
View 9 Replies
View Related
Sep 3, 2006
i would like to hide different sheets at one shut. i tried this, but did not work:
Dim sh As sheet
For Each sh(1 3 5 7 9).Visible =xlSheetVeryHidden
View 6 Replies
View Related
Dec 28, 2006
I would like to be able to use the before save event to hide some sheets before the save then after unhide some sheets. So that the user carrys on with the sheets they had before saving but when the document is reopened the correct sheets are hidden.
This is what I have so far but unfortunately when you click close and then save changes it runs the before save code and then goes around in circles, reasking the user if they want to save changes
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim ws As Worksheet
Cancel = True
Application.EnableEvents = False
Sheets("Protected Content").Visible = True
For Each ws In Worksheets
If ws. Name <> "Protected Content" Then ws.Visible = False
Next ws
Me.Save
For Each ws In Worksheets
ws.Visible = True
Next ws
Sheets("Protected Content").Visible = False
Application.EnableEvents = True
End Sub
View 3 Replies
View Related
Jan 23, 2008
Is there a way to append this code to accomidate accross all sheets?
Sub HideRows()
ActiveSheet.Unprotect Password:="admin"
On Error Resume Next
With Range("e4:e34")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction. Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
ActiveSheet.Protect Password:="admin"
End With
End Sub
View 9 Replies
View Related
Dec 11, 2008
I have some code allowing me to calculate all of my formulas for two of the sheets in my workbook. They are basically the same table on sheets 1 and 2
In the line
View 5 Replies
View Related