Hiding Columns And Sheets Based On Combo-box Values

Nov 4, 2008

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.

View 9 Replies


ADVERTISEMENT

VBA - Hiding Columns Based On Cell Values

Mar 20, 2014

the support this board has given me as I learn VBA. I have three columns - Q, R, and S. I only need to see columns R and S if the cell values don't equal those in column Q or each other. So if I have cell values like the ones listed in the example below, then I don't need to see columns R and S.

Q Header
R Header
S Header
50
50
50

[Code]....

View 4 Replies View Related

Code For Hiding Or Unhiding Columns Based On Row Values

Feb 2, 2007

I'm trying to hide all columns which have the word "hide" in row 6. I have done a similar thing whereby I hide all rows which have the word "hide" in column 3 using the following

Sub HURows()
BeginRow = 9
EndRow = 40
ChkCol = 3
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = "hide" Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub

Alas changing the number and every Col for Row and vice versa doesn't work!! Really I only need to search colums G to U inclusive. The code must also unhide colums if the values in the cells of row 6 change to anything other than "hide".

View 2 Replies View Related

Hiding Sheets Based On Value In Dropdown Cell

Mar 21, 2007

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.

View 14 Replies View Related

Hiding Columns Based On Value

Sep 8, 2013

I have a spreadsheet that I'm trying to hide specific columns. In Row 6 I have the day of the week (Sun thru Sat) and Row 7 with the respective date starting in column F to column ZZ.

I would like to hide all columns with Saturday and Sunday in row 6. I tried using VBA but I'm new to coding and can't figure out the correct syntax.

View 4 Replies View Related

Hiding Columns Based On Cell Value

Aug 7, 2011

I am trying to hide columns where the Value in the cells on row 9 is "", that cell being populated with a formula where the result is "". However I am getting the Compile Error Message 'Next without For'. Any clues?

Sub GraphC()

Dim a As Integer
Dim ColumnVar As Variant

ColumnVar = Array("B", "C", "D", "E", "F", "G", "H", "I", "J", "K")

[Code] .........

View 8 Replies View Related

Hiding Columns Based On Criteria

Dec 7, 2006

I need to run this funtion from the starting column (N) to the last column ( dynamic).

Sub HideUnits()
Dim rngData As Range, rngHide As Range
Application. ScreenUpdating = False
With Sheet1
.Rows(1).Insert
.Range("B1").Value = "Temp"
Set rngData = .Range("N1:N" & .Cells(Rows.Count, "N").End(xlUp).Row)
rngData. AutoFilter field:=1, Criteria1:="*Units"
Set rngHide = rngData.SpecialCells(xlCellTypeVisible)
rngData.AutoFilter
rngHide.EntireRow.Hidden = True
.Rows(1).Delete
End With
Application.ScreenUpdating = True
End Sub

As you might be able to tell I need to hide all the columns with a specific word in the heading. I'm pretty sure I'd need to loop this somehow, but I'm not good with VBA.

View 3 Replies View Related

Hiding And Unhiding Rows In Multiple Sheets Based On Specific Cell Value With VBA

Jan 4, 2013

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.

View 9 Replies View Related

Unable To Hide Columns/delete Values Using Combo Box

Apr 24, 2007

Using two Combo Boxes, I am trying to create an drop down outline form input sheet.

What it does is if you select the first selection in the combo box 1, then it hides certain rows, and deletes certain cells. If you select the second option in the combo box 1, it shows another combo box (2) which has another list of categories.

When I select the option 2 on the combo box 1, it unhides a bunch of rows, and activates combo box 2. However, when I try to select categories on combo box 2, each time it tries to hide/unhide rows I get this message "Unable to set the hidden property of the range class." I have no idea whats going on.

Here is my ....

View 9 Replies View Related

Hiding Columns Based On Other Column Data

Feb 27, 2008

I'm trying to hide columns based on information in another column. If that column contains "A" or "B", hide columns "U" through "W". If it contains "A", "B", "C", or "D", hide columns "V" through "W". Etc, etc., so on and so forth...

I've snipped the code I found earlier and modified it to (what I thought) was correct for my application, but it doesn't seem to do anything. (btw, should I get an error if it doesn't run correctly?)

Here is the code as modified:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "P:P" Then

If LCase(Target.Value) = "A" Or LCase(Target.Value) = "B" Then

Columns("U:W").EntireColumn.Hidden = True

ElseIf LCase(Target.Value) = "A" Or LCase(Target.Value) = "B" Or LCase(Target.Value) = "C" Or LCase(Target.Value) = "D" Then

View 9 Replies View Related

Hiding Columns Based On Cell Value (macro)

Dec 1, 2009

I have an elaborate spreadsheet that I have made for my company. I will give a little background how I have it set up:
E6 contains a drop down menu of all products that we sell, and line items are populated based on the selection here. In columns N and O, I have a "Business Partner Costs" table that calculates a specific discount % based on the business partner.

Some of our products are sold to BPs with no discount. For these specific products, I am trying to get the BP Costs table to disappear, or hide.

Basically, I want something like: "=if(or(e6=ae2,e6=ae7,e6=ae12,e6=ae13,etc),hide columns N&O,show columns N&O)" in macro format.

View 9 Replies View Related

Hiding Columns Based On Date Matching

Feb 15, 2010

I would like to write a macro that automatically hides columns of data
based on the value of a cell (I2) with a picklist. Cell I2's picklist is
monthly values (formatted as Jan-10 though Dec-10 but real values are
1/1/2010 through 12/1/2010). I have a range that contains work week end date
values (1/8/2010 to 12/31/2010) in L6:BK6. I would like to have the macro
hide columns that are less than date value chosen in I2.....

View 3 Replies View Related

Hiding Of Columns Based On Reference Cells

Apr 25, 2006

I'm trying to determine a range of columns I would like to hide by applying HLOOKUP on certain reference cells. The following was what I did:

Sub HideColumns()
' HideColumns Macro
colx = Chr([A25].Value + 64)
coly = Chr([A26].Value + 64)
Sheets("Sheet 2").Select
Columns("" & colx & ":" & coly & "").Hidden = True
'Selection.EntireColumn.Hidden = True
Sheets("Sheet 1").Select
Range("B1").Select
End Sub

I'm referencing cells A25 and A26 as the range of columns I would like to hide in Sheet 2. I equated the cells in Sheet 1 to columns in Sheet 2. Unfortunately, the result was columns being hidden from column 1 to column x instead. I would greatly appreciate if anyone can kindly correct my macro. Also, may I ask how I can distribute the columns evenly after hiding/unhiding?

View 4 Replies View Related

Hiding Columns In The Worksheet Based On Cell Value

Oct 20, 2006

I have a worksheet that has >10 rows of data and over 150 columns. The values in the cells for individual row include NA, NE, D, A and S. Each row will have one or all of these values in one of the cells. Here is the question:

How do I hide columns containing 'NA' in the cell for a particular row, when only that row is selected by clicking on any cell in row 'A'? For example: If my row 3 cell values for column A, J, R, and X are 'NA' I want to hide the column containing 'NA' only and display everything else? And only when I click on row 3 column 'A'

View 2 Replies View Related

Hiding Rows Using A Combo Box And VBA

Aug 18, 2006

I have inserted a combo box on Sheet 1 with two options in the dropdown ('A' and 'B'). I would like to write a macro to assign to the combo box so that if the user selects 'A' from the dropdown, rows 1-3 are hidden on Sheet 2, and if 'B' is selected, rows 4-6 are hidden (with rows 1-3 unhidden). I have tried unsuccessfully to write any script that even comes close!

View 6 Replies View Related

Combo Box Values Based On Another ComboBox

Jan 4, 2007

I have a worksheet in which i have a set of data similar to the following (i have used colons as delimiters in this example).........

Basically what i want is 2 combo boxes. The first combo bow will allow you to select the phone type (e.g. Motorola PEBL, Motorola RAZR etc etc). The second combo box will have a list of items which match up to the value selected in the first combo box. Once the item has been selected from the 2nd combo box then the relevant matching data will be shown in a group of cells on the worksheet on which the combo boxes reside.

I know that this could be done by using the data validation feature if my data were laid out in a different way however it is not possible for me to re-lay out all the data in my worksheet. I have been told that there my problem copuld be potentially solved by using Excel VB but unfortanately my VB skills are quite weak.

View 2 Replies View Related

Hiding Specific Columns Based On Drop Down Menu Value

Dec 17, 2009

I have this model I created where I have two tabs. One tab is an input tab using validation and drop down menus and the other is a display tab. I simply want to hide certain QTRs based on the value of one of the drop down menu results. I tried writing the VBA code below but am a novice when it comes to code. Can somebody please help me fix the below code so that it works properly.

Public Sub hide()
If Worksheets("input").Range("b14") = "Q1" Then
Worksheets("Group P&L").Columns(c, d, e, h, i, j, m, n, o, r, s, t, w, x, y).Hidden = True
ElseIf Worksheets("input").Range("b14") = "Q2" Then
Worksheets("Group P&L").Columns(c, d, h, i, m, n, r, s, w, x).Hidden = True
ElseIf Worksheets("input").Range("b14") = "Q3" Then
Worksheets("Group P&L").Columns(c, h, m, r, w).Hidden = True
ElseIf Worksheets("input").Range("b14") = "Q4" Then
Worksheets("Group P&L").Columns.Hidden = False
End If
End Sub

View 9 Replies View Related

VBA For Hiding Cells Based On Values?

Apr 18, 2014

I'm using the below macros to hide or unhide rows based off of a value in column A. Column A contains an If statement that looks for a value in column F, and depending on whether the corresponding cell in column F contains a value the if statement returns either True or NO-IF(F>0,True,"No).

It currently takes quite a bit of time to run this macro. Given the specs on this machine, I'm convinced that there is probably some loop or inefficiency in my code.

Sub Button1_Click()
Dim cell As Range
For Each cell In Range("a59:A1472")

[Code]....

View 3 Replies View Related

Merging Code For Hiding Columns And Setting Chart Axes Values

Feb 23, 2010

I'm trying to create a code that when run hides a selection of columns and defines the minimum and interval value for a chart on the active worksheet. My attempt is assigned to the 'update skills' button at the top of the "GRAPH" worksheet of the attached workbook.

View 2 Replies View Related

Hiding Rows Based On Multiple Values

Aug 7, 2012

I've tried several approaches on how to code this, but can't figure out how to work it. I have a large spreadsheet; which dynamically changes in both column and row counts. So, I have an array of values. If any cell has a negative value, that cell text needs to be changed to red AND that row needs to remain displayed. If ALL values in that row are >=0 then the row can be hidden.

The array is actually a pivot table named QTD

For Example: If cell D5 = 5 and F5 = -3 then Row 5 should remain displayed.

If Cell D6 = 5 and F6=0 then row 6 should be hidden because all values are > 0

Then I was thinking of using the case statement to hide the rows but can't figure the syntax. I'm open to any other means of performing the taks as long as the initial array dynamically to encompass all the data.

View 7 Replies View Related

Hiding Rows In VLOOKUP Sheet Based On Null Values

Dec 30, 2013

I have created a spreadsheet from a master using vlookup. I want to be able to hide rows which contain a null value (NA) in column B (sample attached). Is there a formula I can use which won't interfere with the vlookup or do I need to hide the rows individually? I tried filtering but that only filtered the cell and not the whole row.

test sheet.xlsx

View 3 Replies View Related

Values Of Combo Box Dependent On Selection In Another Combo Box

Oct 9, 2008

The first combo box is on a userform so that a subject can be selected

View 3 Replies View Related

Hiding Sheets But Still Letting Macros Run When Printing Hidden Sheets

Nov 10, 2008

i have a workbook that has the following sheets

working sheet
job sheet
receipt of deposit letter
completion sheet
delivery note
delivery note (2)
odd
even
t&t
glass
ggf

i want to hide every sheet except the working sheet.
I have tried this but the macros bring up an error when i run the macro

my macros involve printing certain pages dependng on what button is pressed

i get an error whatever
how do i stop this

View 14 Replies View Related

Re-Naming Sheets Per Cell Data & Hiding Sheets

Aug 26, 2009

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.

View 4 Replies View Related

Count Unique Values In Column Based On Values In Other Columns

Mar 14, 2014

I'm running into an issue trying to calculate unique values in a Data column based on a few variables in other columns.

My current formula in Summary tab D4:D19 is
{=SUM(IF(FREQUENCY(IF(Data!$I$3:$I$66<$E$1,IF(Data!$A$3:$A$66=$H$1,
IF(Data!$C$3:$C$66=A4,ROW(Data!$I$3:$I$66)))),ROW(Data!$I$3:$I$66)),1))
+
SUM(IF(FREQUENCY(IF(Data!$I$3:$I$66<$E$1,IF(Data!$A$3:$A$66=$I$1,
IF(Data!$C$3:$C$66=A4,ROW(Data!$I$3:$I$66)))),ROW(Data!$I$3:$I$66)),1))}

This is currently counting the number of times a date value (data column I) appears for that name (A4:A19) in the data when meeting all of the conditions. I need it to instead count the number of times a unique date appears for that name with the additional conditions met (which all appear to work fine).

The results in the pink highlighted cells (Summary column D) should be:

Names starting with A - 3
All others - 2

I've left some other columns in the data with X's so that I can easily convert this back to my working spreadsheet.

View 2 Replies View Related

Hiding Sheets

Jun 11, 2009

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

View 9 Replies View Related

Insert Row (Based On Values In Range) With Sum Of Values For Other Columns

Apr 21, 2014

I have different reports, some have fifty transactions, others have thousands. My goal is to: Insert a new row every time the values in the "Account" column meet a certain criteria, AND THEN add the totals for the Debit and Credit Columns.

Let's say I start with a table that looks like this:

A
B
C
D
Dept
E
Account
T
F
F2
G
Debit
Credit
Total

33010

[Code] ....

I want to group the first four rows because Accounts 33010 and 33015 are in the same department. Same with 50050 and 500060. I want to then insert a row below the last row with "33015" as its Account #. And add the values for Debit and Credit. It'd look like this:

A
B
C
D
Dept
E
Account

[Code] .........

Honestly, I have tried everything. Running a Macros with Relative reference does not cut it.

View 8 Replies View Related

Combo Box With Clickable Different Sheets

May 31, 2009

I have joined here with a great expectation. I used the Forum MR Excel , i posted my question there but no one replied . I hope i will get the answer to my question here. My question is

I Have Combo box

When i click on it i get three Things which i have inputed in the list .

1 ) Machine
2 ) Car
3 ) Bike

With each list , a seperate sheet is assign with complete details like machine for machine sheet , car for car sheet and bike for bike sheet .

Now what i want is when i click on the machine i want the Machine sheet to popup within the same workbook , and when i click car i want the car sheet to popup and same for Bike .

I tried to Assign Macro , but for each list , i am getting the same / last result

here is the code

View 14 Replies View Related

Hiding Of Sheets Through Yes Or No Selection?

Aug 19, 2013

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.

View 6 Replies View Related

Hiding Many Sheets In List?

Jan 8, 2013

Cells B2:B100 contain a list of sheet names, cells C2:C100 have entries TRUE or FALSE.

Is there away to setup a macro that goes through the list and if false, make the sheet very hidden, if true it should be visible?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved