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
ADVERTISEMENT
Feb 2, 2013
im trying to create a drop down menu that changes depending on the results of a vlookup. example: I have a vlookup function that populates a field with a product name based on the part number, however in some cases there are multiple products with the same part number. is there a way to create a drop down menu that contains all the product names shared by the same part number based on the part number that was entered?
View 1 Replies
View Related
Oct 15, 2009
I am making a form. At the top there is a dropbox with a list of applications. Based on which application the user picks, I want another section of the form to populate check boxes with the name of the projects that are associated with that application. Some applications have 2 projects, some applications have 7 projects.
View 12 Replies
View Related
Dec 15, 2009
Attached is the file i am working with. The table spanning from A:AA5:16 contains hours worked per day of the week with respect to the Project chosen from the drop down menus in A7:16. Cells in the range of F,K,O,R,U,X,AA7:16 total those hours worked on a daily basis. The table below should sum the total hours worked per day according to the Project selected in A19 from the drop down menu, with respect to the Project(s) chosen in cell range A7:16. For example, if i am looking for total hours worked Monday on Project RSB i select "RSB" from the drop down menu in cell A19, i want cell F18:19 to be the sum of cells A7 and A9, with respect to the Project selected from cells A7:16. If I select "FRG" from the drop down in cell A19, i want cell F18:19 to reflect the sum of cells F8 and F10.
View 2 Replies
View Related
Oct 18, 2008
I have a column with various drop down menu boxes and I need to add another selection to the menu list. My problem is, it's been so long since I did the drop downs, I have forgotten how to do it..
View 3 Replies
View Related
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
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
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
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
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
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
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
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
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
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
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
View Related
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
Sep 8, 2009
I have about 10 rows of data that have columns of information describing computer hardware and pricing. There are 10 rows, because each row represents a different country and different tax rates and pricing changes per country. So each column of a row has a specific formula to calculate information for that row's country information. All these 10 rows of formulas are kept as a reference at the bottom of the sheet.
At the top of the sheet I need to have a drop down menu to choose a country and then it will automatically copy and paste the row of that country to the current row at the top.
Is there any easy copy/paste macro for such a thing?
View 9 Replies
View Related
Jan 7, 2009
I can weld together a bare chassis, or a complete turn-key car, or anything in between. With that I am putting prices next to every option, and part n piece that goes on the chassis. This is fine when I choose welded chassis under car type and just add a few options to it.
However if I choose turn-key or even roller, there are items that i need to choose between like rear coilover manufacturer and what not, but I dont need to add that price in considering its already included in the turn-key price of $135,000.00
So my question is, if I choose bare chassis, can I leave everything the same, but if I select turn-key, can I make it so it does not include that price in the bottom total cost of the car?
View 3 Replies
View Related
Oct 14, 2008
If you choose entry number 1, Lines 10 to 14 are hidden. If you choose entry number 2, Lines 15 to 29 are hidden and lines 10 to 14 are unhidden. If you choose entry number 3, Lines 20 to 25 are hidden and lines 10 to 29 are unhidden
Until now i have the following:
[Private Sub Worksheet_Change(ByVal Target As Range)
Rows("10:25").Select
Selection.EntireRow.Hidden = False
If Range("A1") = "1" Then
Rows("10:14").Select
Selection.EntireRow.Hidden = True
ElseIf Range("A1") = "2" Then
Rows("15:19").Select
Selection.EntireRow.Hidden = True
ElseIf Range("A1") = "3" Then
Rows("20:24").Select
Selection.EntireRow.Hidden = True
End If
End Sub]
View 2 Replies
View Related
Jan 5, 2014
Looking to get a "X" to appear in appropriate box "in leave request form tab, cell M14, modified PTO box" that corresponds with correct selection from drop-down menu "in leave calendar tab, cell K6"... if i select "modified PTO from the drop down selection in K6, i would like to see a ""X" appear in "leave request tab, cell M14", then i can apply the formula to the rest of the selections in the drop -down...
View 5 Replies
View Related
Feb 28, 2007
how to create a drop down menu and grab data from the other side. pls have a look for a while at my attachment to check it...has anybody can provide me the steps
View 12 Replies
View Related
Jan 15, 2009
I'm looking for cell j3 to add up al the things in row 3 so in the attached case it will come to £3.00 ....
View 9 Replies
View Related
Apr 7, 2009
I have another question with my red sox scores excel sheet. On my overview I want to be able to select any team, and view the indiviual stats against them. For the life of me I dont' know/can't find how to even do a simple yes no if statment to what the value in the drop down menu box is.
View 3 Replies
View Related
Jul 30, 2009
I want to make a drop down menu whereby each choice in the drop down would re-calculate my workbook.
Let me explain:-
I want to make a drop down menu in sheet 1 with 3 choices.
The 3 choices come from sheet 2 (row 1, column A, B, C).
I have data in sheet 2 in rows 2 through to 6 in columns A, B, C.
I have sheet 3 that currently uses the data from sheet 2 row 2 through to 6 for column A.
I want to be able to use the drop down menu in sheet 1 to choose either column A, B, or C in sheet 2 and then re-calculate the data in sheet 3 accordling.
I have the drop down menu made now.... but how can i re-calculate the values in sheet 3 after choosing a choice in the drop down?
View 9 Replies
View Related
Nov 1, 2009
If I change the country in cell B2, I would like to have that the cells D2, E2 and F2 show the same name as cell R2. (This is always the first option of the drop menu's)
Cells D2, E2 and F2 are made by using the validate option in order to get drop down menu's.
The source information is in the hidden columns I-Z.
So for example:
if I change cell B2 to Belgium, I would like to see that D2, E2 and F2 also show Belgium immediately. I can then select the place I want to move from Belgium to by using the drop menu in D2 (for exampla Belarus).
As I selected for D2 Belarus, this has to be shown in E2 and F2 also.
I can now select E2 (for example Austria).
If Austria is selected in E2, I want to see this also in F2.
To recapitulate:
If I select Belgium as starting place, I want to see in movement 1,2 and 3 also Belgium, as there hasn't been anymovement yet.
If I let my army go from Belgium to Belarus, I want to see for the two remaining movements Belarus (as this means that the army remains in Belarus)
If I let my army go forward after Belarus to Austria, I want to see in the last movement phase Austria (no movement). If I still want my army to move I can still adapt it.
View 2 Replies
View Related
Dec 10, 2008
I've attached the xlsx file with this post. Now I've created a drop down menu with the 3 values I want to choose from. These values refer to the table situated directly above the drop down menu. Basically, in the end I need to calculate a 'Throughput' value which is supposed to depend on what I choose in the drop down menu.
For instance, if I choose 'Paddy' in the drop down menu, I want the corresponding bulk density and velocity values selected (same row). Similarly for the adjacent table, if I choose model 400/180 in the drop down menu, I would like the corresponding bucket capacity to be selected. I know my question is rather lengthy, but I'm sure the solution is rather concise. I just can't seem to remember or search for the solution!
View 2 Replies
View Related
Jan 7, 2009
I have setup a worksheet with multiple drop down menu's, all with different available options to choose from. If I go to the 1st drop menu and select say option 2, is there a way I can assign a dollar value to option 2 so that when I select that option, it posts the dollar value next to the drop menu? Then go to the 2nd drop menu select say option 4 or whatever, and do the same with the value.
That way at the end of the list of drop menu's I have a total of what the options that I have chosen for this particular piece to have and have a running total of what it costs?
To get the drop menu's I just listed a bunch of options for question 1, then went to data, validation, list, and selected those options. Then did the same and so on for other options.
View 7 Replies
View Related
Nov 29, 2006
I do a lot of horse racing ratings in Excel, in fact its the only way I do the form these days.
The thing is I'm always looking for ways to save time and was thinking the other day about how I enter the results.
I would like to have "drop down menus" for each of the place getters that I get from another sheet in the workbook.
Is there a way to do this? I'm using excel 2007 (which I love)
Race 1 sheet is named race1 and have up to 24 horses/names to pick from
View 9 Replies
View Related
May 3, 2006
How do I create drop down menus in a spreadsheet?
View 4 Replies
View Related