VBA Hide Rows Based On 4 Different Values With Combobox

Nov 16, 2011

I have a vba to hide certain rows based on 4 values (either 15, 20, 25, 30) are the choices in the 'ComboBox' drop down list. I also have the rows grouped so i need to make sure to collapse those back each time. Here is the vba i'm using, but its not quite right for some reason.

PHP Code:

Private Sub ComboBox1_Change()        
If Range("J8").Value = "15" Then            
Range("A185:A244").EntireRow.Hidden = True            
Range("A245:A304").EntireRow.Hidden = True            
Range("A305:A364").EntireRow.Hidden = True            
Range("A365").EntireRow.Hidden = False            

[Code]...

View 1 Replies


ADVERTISEMENT

Hide Rows Based On Combobox?

Apr 12, 2012

I am creating a survey and have used combox,i want hide rows if the result in the combobox is no

View 1 Replies View Related

Hide Rows Based On Combobox Selection

Dec 16, 2006

I know there are a lot of hide row threads... i've searched for ages... but (unfortunately) i can't a solution that addresses my problem and I'm stuck. Please help!

I have a data between rows 10 and 1310 and I would like to use a combo box option to select and view certain rows of data only. I don't want to use auto filter because i have a separate macro using an auto filter on the same data - they won't play together.

So in short - combo box will contain values from column A. When value is selected from combo box hide all non matching rows based on column A values.

So i have added a combo box to sheet1 and populated it with the following workbook code...

Sub Workbook_Open()
With Sheets("Sheet1").ComboBox1
.AddItem "Select Product Type"
.AddItem "Apples"
.AddItem "Mangoes"
.AddItem "Oranges"
.AddItem "Clothes pegs"........

View 9 Replies View Related

Hide Blank Rows Based On Values In Other Rows

Nov 3, 2006

I have a worksheet used for inventory. In Column A is the quantity (to be entered manually). In Column B is the product description. In Column C is the price of the product, and Column D the total price (column C price x the quantity entered in Column A). At the bottom of the worksheet is a grand total. Also, Column B (products) is grouped into subheadings by the supplier each product came from (for example, row 6 has the title PPG, and then rows 7-137 list every product from PPG).

The calculations in this worksheet work fine. What I am trying to do is, using a macro once all of the appropriate quantities are entered in column A, automatically hide every row of product that does not have a quantity. The tricky part is, if no products under a given supplier subheader are entered, the subheader also hides, and if a quantity is entered, that subheader shows. For example, if I have no quantities under any products for PPG, then the PPG subheader hides, but if just one quantity is added, PPG shows. Also, this list will be constantly updated, new products will be put in and taken out all of the time, so I cannot base the macro on a specific number of rows.

View 2 Replies View Related

Hide Rows Based On Two Cell Values

Feb 1, 2009

Is there any way to hide a row if columns 6 and 7 both show either a "-" or a number lower than 0.5? Cells in both rows contain a VLOOKUP formula.

View 9 Replies View Related

Hide Rows Based On Other Cell Values

Sep 8, 2007

I need to hide rows on a worksheet based on entries from DATA VALIDATION dropdown lists on another. Due to the fact that all the entries are on a different page, and there is no active cells or entries made on the "second" worksheet, the WORKSHEET_CHANGE events will NOT work. Trust me, I have spent two days searching the net for a possible answer and trying every trick I could find. Not to seem redundant or a pain, but right from the git-go, FORGET the WORKSHEET_CHANGE event as an option. I need a way to fire the macros from a formula change in a linked cell, and it won't be an active cell, nor will there be any kind of entry made on that page at all. ALl the entries (choices) will be made on another sheet, but the result needs to be hiding the rows not required based on the choices I make. There are over 300 lines and when I am done there will be only approximately 35-40 left. Right now the people using this are actually making copies of the workbook, and then deleting the worksheets they don't need (I am hiding those with an array) and then deleting the lines they don't need on the worksheet remaining. (Stupid and slow I know, but I didn't develop this workbook, I'm just trying to bring it out of the stone age) Here is some sample code with what I want to do, except it is of a WORKSHEET_CHANGE nature and will not work.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("INPUT!M6"), Target) Is Nothing Then
Rows("11:50").Hidden = True
If LCase(Range("INPUT!M6").Value) = "100" Then Rows("31:50").Hidden = True
If LCase(Range("INPUT!M6").Value) = "100" Then Rows("11:30").Hidden = False
If LCase(Range("INPUT!M6").Value) = "225" Then Rows("11:30").Hidden = True
If LCase(Range("INPUT!M6").Value) = "225" Then Rows("31:50").Hidden = False
If LCase(Range("INPUT!M6").Value) = "0" Then Rows("11:50").Hidden = False
End If
End Sub

View 9 Replies View Related

Hide Range Of Rows Based On Cell Values

Aug 13, 2014

I've been trying to put together some code to hide a range of rows on one page based on cell values on a different page. So basically Sheet1 cell A1 value is 10, A2 value is 20. When macro is run via button rows on Sheet2 from 10-20 would be hidden. The issue is the values in the cells on Sheet1 will vary. I thought something like the following would work but it doesn't.

[Code] ....

View 6 Replies View Related

How To Hide Specific Rows Based On Values In A Different Worksheet

Mar 7, 2014

Say I have two worksheets, "Sheet1" and "Sheet2". Let's also say A1 in Sheet1 could have one of four values: cat, dog, rabbit, mouse. Now, based on which value cell A1 on Sheet1 is, I need different rows hidden in Sheet 2. For argument sake let's say if cat is chosen rows 1-5 are hidden, if dog, 6-10 and so on.

View 5 Replies View Related

Hide Rows Based On Values In A Cell Automatically

Apr 8, 2014

I am trying to hide rows based on values in a cell in that row. I have formulas in column xea that yields a 0 or 1 and I want to hide all rows with 0.

The code below works but I have to run the macro. I want it to happen automatically when the cell values change and I have not been able to figure it out.

Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual

For Each c In Range("xea1:xea350")

[Code] ........

View 9 Replies View Related

Hide And Unhide Rows By Selecting A Letter From A Combobox

Feb 28, 2007

i have a combobox and have A, B, C, as options in the combobox

then I have a table from row 10 to row 50

if A is selected from the combobox, I want excel to show only rows 10 to 20 and hide rows 20 to 50

if b is selected from the combobox, I want excel to show only rows 20 to 30 and hide rows 10 to 20 & 30 to 40

if c is selected from the combobox, I want excel to show only rows 30 to 40 and hide rows 10 to 30 & 40 to 50

in other words, i want all rows 10 to 50 hidden at all times, until a selection A, B, C is made in which i want thoes related rows to be shows and all other rows between rows 10 to 50 hidden.

View 9 Replies View Related

Conditionally Show / Hide Combobox Based On Cell Value

Jun 5, 2013

I'm quite new to VBA, but I am attempting to get a Forms ComboBox to appear or disappear based on whether a certain cell (P7) reads YES or NO. P7 in turn updates in turn based on a user-selected value. As of now, the ComboBox only appears or disppears if I go back in and out of the formula I entered into P7. Basically, I want my ComboBox to dynamically update based on the value in P7. That may sound a little muddled, so here is my code for the ComboBox:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("P7")) Is Nothing Then
If UCase(Target) = "YES" Then
Me.Shapes.Range("Drop Down 30").Visible = msoTrue
Else
Me.Shapes.Range("Drop Down 30").Visible = msoFalse
End If
End If

End Sub

View 3 Replies View Related

Excel 2010 :: Hide / Show Textboxes And Labels Based On Combobox Selection?

Jul 8, 2014

I have created a UserForm that has a ComboBox and depending on the number selected I want it to show that number of Labels/TextBoxes...

So if I select "0" nothing is shown, if I select "1" one set of Labels/TextBoxes is shown, select "2" and two sets of Labels/TextBoxes are shown... but also if I have selected "2" and then select "1" I want the second set to be hidden again...


Also I know I should have renamed the Label/TexBoxes to make it easer but I was adding things and making it up as I went along...

I'm using Excel 2010 on windows 7.

Code:
Sub UnHide_NewRoutings()
If (Engineering.ComboBox2.value) = "0" Then
Engineering.Label4.Visible = False
Engineering.TextBox5.Visible = False
Engineering.Label9.Visible = False
Engineering.TextBox9.Visible = False

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

View 3 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

Hide/unhide Rows With Zero Values

Jun 19, 2007

Need a macro which will hide rows having 0 values. On running once it will hide those rows having 0 values and on pressing second time it will unhide those hidden rows and so on.

View 14 Replies View Related

Hide Rows Not Having X Consecutive Values

Dec 12, 2006

I wanted to see if there was a way to hide rows that do not have a pre determined amount of values in a row (one after another). Attached is a simple spread sheet to hopefully illustrate what I need.

I'd like to be able to only show rows where 2 consecutive 0's exsist. Then 3 consecutive 0's. Ultimately I'd like to show anywhere from 2-12 consecutive 0's and have that selection available via the combo box.

View 5 Replies View Related

Populate Userform From Row Values Based On Combobox?

Jul 20, 2014

how can I build a userform to display all values from a row? in order to select a row, i was thinking to use a combobox to display values from one column and based on that selection, display all values in that row? the reason i want to use a userform is because i would also like to be able to edit that data.

View 3 Replies View Related

Excel - Hide Rows Depending On Values

Sep 12, 2013

I have created an excel document with If formulas. If nothing gets entered in that particular row, the row simply says "None". Is there a way to get rid of any row that contains that value by any chance?

Something along the lines of if the row says "None" then that particular row gets automatically hidden? It would probably need to be in VBA?

View 9 Replies View Related

VBA Rookie. Need To HIDE Rows Containing Error Values

May 17, 2007

Just looking at the first or second Column, need to Hide all ROWS which either contain "#VALUE!" or "N/A".... The sheet data changes for any age the user input...

View 9 Replies View Related

Hide Rows Which Dont Have Specific Values

Sep 13, 2006

I’ve got a spreadsheet with approximately 30,000 rows and I would like to create a macro which hides every row which has not the value 12, 14 or 19 in column I. What is the best way to do it? With an if statement?

View 4 Replies View Related

Filter Choice Selection Based On Combobox Values?

Apr 24, 2014

I am trying to create a macro that will allow the user to select choices from combo boxes on a userform. The choice of one combo box determines what will be shown in the next combo box and so on. This will occur a set number of times (depending on what they are looking for), at which point the list of possible choices will be presented.

I populated one combo box in UserForm_Initialize() but then I might have to change the others with Combobox1_Change()...

View 4 Replies View Related

Hide Rows Based On Two Conditions?

Apr 3, 2013

I'm trying to hide rows in an excel sheet based on two stipulations. I want to hide the row if it finds a particular value in column B and a different particular value in column K, otherwise i want it to do continue looping until it has hidden all rows that meet both stipulations.

VB:
Sub hide_loop()
Dim bl As Excel.Range
Dim blrange As Excel.Range

[Code]....

Currently I have tried different approaches, like a Do Loop, but I could not make that work, and this seems closer. The problem I'm having right now is that with this loop it hides everything found in column B regardless of what is in column K. I suspect this is because of the code following the if statement.''

View 9 Replies View Related

Hide Rows Based On Autofilter

May 7, 2014

I have a spreadsheet that is split in two parts , one with headers in row 16 with data flowing down to row 190. In row 192 I have another set of headers with data flowing down from that to row 300.

I have a userform (roughly at cell B13 in the attached) that filters the first block of data into either Company, Syndicate, EU Corporate or ALL. (ignore the other filters) which feature in range B18:B190

What I want it to do, is that when one of the three options is selected, ie Company, is that all rows from 193 down are hidden other than those that are also Company (in the test case there is just one row). The same is true for when Syndicate or EU Corporate are selected in the userform, and if the ALL is selected then none are hidden.

View 2 Replies View Related

Hide Rows Based On Date

Jan 2, 2009

I need to write a macro that will hide several rows if a calculated date's month is not within the month of the report.

Example:
If month of date in cell B20 is not the same as the month of date in cell A5
then hide rows 20 thru 30 if it is the same month, display rows 20 thru 30.

I need to do this comparison twice. If month of date in cell B40 is not the same as the month of date in cell A5 then hide rows 40 thru 50 if it is the same month, display rows 40 thru 50. The dates in B20 and B40 are the result of a calculations (Date in cell A5 plus some number of days) if that makes any difference. I don't think it should.

View 3 Replies View Related

How To Hide Rows Based On The Value Of Two Columns

Apr 11, 2009

I need to filter out rows, based on a specific value in column A, (documents on file for the clients), then check column C (last name) and D (client first name), which can have the same client listed multiple times, based on how many different documents are on file ......

View 12 Replies View Related

Hide Rows Based On A Criteria

Oct 6, 2009

What am I doing wrong here?

I have a code and it doesn't error out, but it won't hide the rows either. I'm pretty sure the red is what needs to be altered. I've tried adding "Selection.", "Rows." and "Cells." and none of them are working.

View 12 Replies View Related

Macro To Hide Rows Based On 'Sum'

Dec 26, 2009

I want a code to Hide the row if "sum of numbers in columns three thru last column" = 0. Following is a code I use to delete a row if that is blank. The difference here is that I dont want to to check first two columns and I want to hide them rather than deleting.

View 4 Replies View Related

Hide Rows Based On Value In Cell G2

Nov 18, 2011

I am using windows 7, and excel 2007. I want to hide rows bases on a value in cell G2 which is a date field

Example, if G2 is greater than 11/16/2011 then hide rows 1969 through 2032.

View 6 Replies View Related

VBA Hide Rows Based On Cell Value

Mar 27, 2012

With a piece of code that will hide an entire row if a cell value in that row does not equal the cell value of another row.

Example

Cell d3 = Feb 2012.

Range C5:c252, = a mix of Feb 2012 and Mar 2012.

I want to hide all the Mar 2012.

However if Cell d3 = Mar 2012 then the range C5:C252 will also = Mar2012

I want to see all the rows within that range.

View 4 Replies View Related

Hide Rows Based Upon Value In Cell?

Apr 9, 2014

I am trying to auto hide rows in a spread sheet. the start row will always be 55 and the end row will be 55 + the value of cell A38 in sheet titled "Main".

View 2 Replies View Related

Hide Rows Based On Value In 1 Column

Dec 30, 2009

I wrote some simple code to work through a number of rows and hide the rows which contain a value of "XXX". For some reason, when the code hits the line denoted with? it hides the first row of "XXX"'s but then starts all over again at very first line of code outside the loop.

Sheet1. Range("start_1").Select 'cell c53

Do Until ActiveCell.Value = "EOF" 'cell c266
If ActiveCell.Value = "XXX" Then
Selection.EntireRow.Hidden = True '????
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Loop

View 2 Replies View Related







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