Hide Worksheets Based On Tab Color
Apr 9, 2014
Found a closed post on a solution that is almost what I am looking for, described by the following tab layout...
All tabs in worksheet: Master1, Tab1, Tab2, Master2, Tab3, Tab4, Master3, Tab5, Tab6
Click Master1: Visible - Master1, Tab1, Tab2, Master2, Master3
Click Master2: Visible - Master1, Master2, Tab3, Tab4, Master3
Click Master3: Visible - Master1, Master2, Master3, Tab5, Tab6
When you click a master tab, all tabs that are NOT the same color as that Master are hidden (except other masters)
This bit of VBA does the trick however I would like it to be color based. In this model below, you have to manually add the worksheets that belong to a particular master.
The behavior I seek is to associate a worksheet with a master by changing its tab color, and not having to do it in the code. I think it could be accomplished by cycling through the workbook and creating an array of tabs based on tab color.
'=============>>
Private Sub Worksheet_Activate()
Dim sh As Worksheet 'Object
Dim arr As Variant
arr = Array("Sheet1", "Sheet2", "Sheet3") ' <<=== CHANGE
[Code] .....
View 5 Replies
ADVERTISEMENT
Apr 4, 2008
I have the following code to hide rows based upon whether or not the cell in column A is black or not.
Sub hide_black()
Dim Rng As Range
Dim MyCell As Range
Set Rng = Range("A2:A36635")
For Each MyCell In Rng
If MyCell.Interior.ColorIndex = 1 Then
MyCell.EntireRow.Hidden = True
End If
Next MyCell
End Sub
I was thinking of taking this one step further and having the rows hide automatically once the cell is turned black allowing the user to bypass having to click on a macro button.
View 6 Replies
View Related
Nov 5, 2009
a way to hide used rows if the color of the cell in column I is green( color 35 vba) but only if the cell is visible will the macro change the rows visible state, in other words already hidden rows will remain hidden regardless if they match the color requirement.
below is some pseudo code to try to explain better what I'm trying to do. The below code doesn't actually work but I was wondering if someone knew some code that would actually do what I've described.
View 12 Replies
View Related
Feb 20, 2008
I am making a new stock card system to keep track of stock at work for a new storeman working in my department. What I want to be able to do it hide/show sheets bases on their colour, the reason I want to do this is because I want the new storeman to be able colour code products and only show certain ones at any one time to stop him from having to sort through loads of sheets, but also for him to be able to add extra sheets and asign them a colour and not need me to modify code and put it into category X So in summary, I want code that will hide all sheets that colour is red or blue etc and not need updating when new sheets are added.
View 4 Replies
View Related
Jan 29, 2014
I am in need of a macro to hide worksheets that do not match a certain cell value (which I have range named) in the "input data sheet". If this value matches cell value on the other worksheets, then hide all other worksheets and keep the "valid" worksheet visible
NVS_SCN is the range name that needs to be compared to the value in P4 of worksheets 2 thru 4
Example: NVS_SCN (located on the LANDFILL_DATA wksht) = RC_SOUTHLF
I want the Macro to hide all worksheets except for the South Region LF_VOL_Trend sheet,
if NVS_SCN = RC_MWESTLF then hide all but Midwest Region LF_Vol_Trend
I am attaching a file. I have seen macros to "unhide" or "Hide Rows or Columns" but I am not adept enough to figure out how to utilize range names and hide all but the one I want. As for "recording" the macro, I didn't know how to do the compare part.
View 13 Replies
View Related
Jul 2, 2014
My company has a canned template for some of the work we do and to avoid wasting too much paper I wanted to insert some extra code into an already programmed macro button (which sets the page breaks) to hide forms (both as individual worksheets and rows within separate worksheets) if the field that ought to auto-fill them is left empty.
View 3 Replies
View Related
Feb 26, 2014
I am hoping to create a drop down list of months in one sheet, and when I select a certain month, columns in about 10 other worksheets in the same workbook will either hide or unhide columns...
The spreadsheet is laid out with columns (C-N) for each month in the year, for actuals, then columns for budget and budget variance (O-P), then YTD Actual, YTD Budget and YTD Variance. When I select September, for example, I want October-December to hide, and leave Jan-Sep unhidden, while keeping the budget, YTD and variance columns.
Is there a VBA code that can achieve this?
View 14 Replies
View Related
Apr 11, 2008
I have got a userform with lots of controls,
One of the action's on a large group of the controls is the same but except for one number
here is an example
If TextBox107.ForeColor = 255 Then ActiveCell. Offset(0, 53).Font.ColorIndex = 3
If TextBox108.ForeColor = 255 Then ActiveCell.Offset(0, 54).Font.ColorIndex = 3
If TextBox109.ForeColor = 255 Then ActiveCell.Offset(0, 55).Font.ColorIndex = 3
This makes a cell that correlates to the textbox red if the text in the textbox is red.
Now, I loads of these textboxes that all need to run the same code with just the Offset value one digit higher than the last and I was hoping I could create a loop to avoid a huge block of code but I can't work out how to make a constant that will +1 with each loop.
Also, can I assume that a loop will start with the control with the lowest number i.e. Textbox1 and then work its way through the rest of them in order?
View 3 Replies
View Related
Jan 15, 2009
I wrote a macro to color the cell values in the rows based on their average value. For eg if the cell value is less than 0.2 Avg, they should be red color,if value is between 0.2 and 0.5 it should be yellow. This part is working fine
Now based on the color of the rows cells , need to write a macro for the header one. Logic is Coloum header should be in red colour, if in one or more number of rows cells are red. same with yellow ones. Could you please help me out in solving this with logic.
View 8 Replies
View Related
Oct 27, 2009
I have attached the relevant spreadsheet for which I need to alter the color of the columns based on Site number ( Sheet 1). % Mortality will be represented in the Y-Axis, and the Site numbers would be on the X-Axis. All columns (% Mortality) except one will be of the same color, and the one of a different color will indicate a specific site. As an example, site 86 is colored differently. The way I require the chart to look is shown on Sheet 1.
After reading through some great posts on Ozgrid, I managed to do this using conditional formatting (Sheet 2), but that sort of falls short because I am required to add a data table to the chart, and the parameter that is indicated by the column bars happens to appear twice in the data table.
I was wondering if this can be automated maybe using VBA, but with the possibility of simply matching the color of columns with the font color of respective entry in the data series.
View 9 Replies
View Related
Nov 1, 2009
This is probably elementary, but I'm struggling and would appreciate any help as I have very little excel VBA experience to draw from.
I have assembled code which changes the cell color based on a value change in Column A. Column A will contain many different groups of repeating values. This code works well and and I have been able to figure out how to limit the number of colors to only 2. The end result is each set of similar values in column A is visually grouped by one of two alternating colors.
The number rows in the data set is variable as the data set is extracted from SAP. The number of columns is fixed.
What I want to do now is set the cell color in columns B through F the same color that was assigned to the row in column A. So if cell A3 is set to colorindex = 6, then I want to set the range of cells B3 to E3 to the same color.
Here is the code I am using to set the color of the cells in Column A:
View 7 Replies
View Related
Apr 18, 2008
I have two columns. The first one (A) contains cells that have different Fill colors. The second column (B) contains text adjacent to the colored cells. I am trying to change the color of the text in the second column (B) to the corresponding color in the adjacent cell in the first column (A). I don't think conditional formating works well in this situation. I believe the solution would be some sort of macro.
View 3 Replies
View Related
Oct 17, 2006
I have various row cells in column (F) filled with the color Green. And corresponding text in Column G. How can I change the text of that particular row to white.
i.e.: if any cell in column F is Green, change the text color of that row in Column G to white?
View 5 Replies
View Related
Nov 18, 2007
I am looking for a very simple script that will achieve the following:
On the clicking of a button, Select and shade in a cell yellow, delete the yellow shading of the previous cell. The shading & selection should move up a column of cells, 1 at a time, in the following order:
From B10 to B9, then B9 to B8, B8 to B7 etc until the selection and shading is at B2. Once it is at B2 subsequent clicks will simply keep it at B2 (the top). Thus after 8 clicks the shading & selection should travel from B10 to B2, with only 1 cell being shaded yellow and selected at any one time.
View 5 Replies
View Related
Jun 18, 2008
I have a spreadsheet that i download from the net daily, which is seperated into columns of information.
I want to be able to look down a column and mark a cell in a seperate column if the cell font text is red.
For example looking down column A ... if the font text of a1 is red then mark the cell background colour of T1 red - if a2 text colour is red then mark the cell T2 red .... etc etc.
If the font colour in a1 or a2 ... etc etc is any other colour then do nothing.
I have 5 columns I wish to look down and mark in 5 seperate columns - I have tried to do this by conditional formating but don't know the fomula for checking font colour.
View 9 Replies
View Related
Aug 28, 2008
I have attached a spreadsheet, which has a master data sheet and 2 other worksheets (Sheet 1 and Sheet2) that have linked Choose Functions from the main data worksheet.
I would like to send copies of Sheet 1 and Sheet 2 to seperate people, however would not like them to be able to view each others worksheets or the Master Data sheet, as it is sensitive data.
Does anyone know how I could create a macro, that enables me to click a button which would protect & hide two of the worksheets including the name of the worksheet (e.g. protect & hide worksheet "Data" and "Sheet 2"). This way I could send the entire spreadsheet to someone while hiding the sensitive information.
View 14 Replies
View Related
Aug 2, 2007
i have 5 sheets on my spreadsheet, only one of them is a front sheet, which is used by a agent. Now i need to hide the other 4, but still have them working in the back ground, but when i right click, its not highlighted? The book is not restricted and the sheets or not protected, thou i have tried both ways.
View 9 Replies
View Related
Dec 28, 2009
I received this code which hides blank rows within a range.
View 12 Replies
View Related
Dec 1, 2007
I would like to have cells that conditionally format the font color in the cell based on the background color of the cell. Essentially I have a matrix with some cells highlighted in red, yellow, or orange. There are values in each cell of the matrix. If a value is 0 I want the font to be grey. If the value is NOT 0 AND the cell backgorund color is NOT white, I would like it black and bold. Is there any way to do this in excel or using VB?
View 6 Replies
View Related
Nov 23, 2006
I have an Excel spreadsheet from which I run a macro to open another workbook. This other workbook has multiple worksheets. The problem I have is that I never know which worksheet was left active whenever it was last saved. How do I revise my macro to open this workbook and make a specific worksheet active and hide all other worksheets?
View 9 Replies
View Related
May 3, 2007
Develop a macro that will enable me to hide or unhide worksheets.
Basically, I have a few worksheets in my workbook and I want to have a page at the front with two buttons. One for Unhide sheet and the other for Hide sheet. Once activated, I want it to give me a list of worksheets that I can click to hide or unhide (depending on the button i click).
View 13 Replies
View Related
Feb 24, 2009
I'm creating an excel workbook that will allow any business or accounting student to go in and create their four year plan while giving them all of their requirements for their particular degree.
One of the features I wanted to have with this program is that it wouldn't display all the worksheets for each major, but rather the ones you choose that you are associated with. I was going to have a drop down menu on the first page that allows you to choose your majors, those being accounting, or business administration with its 5 focuses.
If I just allow all the worksheets to be shown, there would be 6 in total and I thought it might get confusing for a student who's only taking one of the 6. My hope is that on the first page, when you choose one of the options, it would automatically display the hidden worksheet that goes along with that major.
View 6 Replies
View Related
Dec 3, 2011
I have a button (A) that will unhide worksheet A. I would like to add another button (B) that will hide(very hidden) worksheet A (if allready open) then open worksheet B, vice versa when click button A.
Code:
Sub ShowSheets()
With Worksheets("A")
.Visible = xlSheetVisible
.Activate
.Range("A1").Select
End With
End Sub
View 5 Replies
View Related
Nov 5, 2009
Why code will not hide command buttons or worksheets based on a given password. I have attached the code so.
Private Sub Workbook_Open()
Dim strUser As String, strPassword As String
strUser = InputBox("Enter User Name")
strPassword = InputBox("Enter Password")
Select Case strUser
Case "O"
If strUserPassord = "O4" Then
ActiveWorkbook.Sheets("Main").Select
O.Enabled = True
GOODBYE.Enabled = True
S.Enabled = False
R.Enabled = False
A1.Enabled = False
A3.Enabled = False
A4.Enabled = False
Sheets("Set4").Visible = True
Sheets("Set5").Visible = False
Sheets("Set61").Visible = False
Sheets("Set63").Visible = False................
View 9 Replies
View Related
Mar 9, 2014
I got 2 questions:
1) How can I change the font color and background color of multiple worksheets at the same time?
2) How can I change hyperlink color?
View 4 Replies
View Related
Aug 2, 2006
I need to change the color of that part of the excel that shows the name of the worksheet(the location where it's writeen "Plan 1"[I don't know what's the name in english]). How can I do that?
View 8 Replies
View Related
Oct 4, 2013
I have an Excel 2010 file with 10 worksheets. I would like to set up two VBA codes to attached to a two button; one to hide specific worksheets, the other to unhide. The specific worksheets are:
Calculation Sheet
GL Receipt
Sheet2
View 5 Replies
View Related
Nov 15, 2011
I wrote the following code to hide & password protect an excel sheet :
[Code] .....
How could I alter it so that it hides and protects this sheet automatically before closing the workbook ?
View 3 Replies
View Related
Jan 6, 2010
Essentially what I want can be shown in outline form:
I. Stats (workbook)
A. 2009 (worksheet)
1. Jan (worksheet that appears only when 2009 worksheet is clicked)
2. Feb (worksheet that appears only when 2009 worksheet is clicked)
B. 2010 (worksheet)
1. Jan (worksheet that appears only when 2010 worksheet is clicked)
2. Feb (worksheet that appears only when 2010 worksheet is clicked)
I was hoping there was a way to have one workbook that displays only the years (2009, 2010) as worksheet tabs but once clicked, would reveal 12 nested worksheets (one for each month). Once a different year worksheet was clicked, the month worksheets currently displayed would hide again.
View 10 Replies
View Related
Oct 17, 2006
are there means to make visible the hidden rows and columns on all sheets
when the workbook is opened?
View 9 Replies
View Related