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


ADVERTISEMENT

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

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

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 Worksheet Columns Using Listbox?

Oct 14, 2011

using VBA in excel. My questions is: I would like to make a listbox that has 1 column and shows all of the headers in my different worksheet columns, and I would like to hide the columns based on which ones are selected in the listbox, is this possible I am having trouble findings examples online.

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

Conditionally Hiding / Unhiding Rows In One Worksheet By Referencing Cell In Different Worksheet

May 3, 2013

coding a VBA macro for one of my workbooks, in which I need to be able to hide/unhide various rows in one worksheet depending on the value of a cell in a worksheet elsewhere in the workbook. The rows start off hidden by default.

As a simplified example:

Worksheet1 has a cell that has option "Set 1," and "Set 2." Worksheet2 has two sets of rows (say, 20:30 and 40:50) that need to be hidden/unhidden depending on the cell in Worksheet 1. These are hidden to start with!

So if Worksheet1's target cell says "Set 1", then on Worksheet2, rows 20:30 would stay hidden and rows 40:50 would be revealed, and then if the target cell says "Set 2," then on Worksheet 2, rows 40:50 would then be hidden, but rows 20:30 would then be revealed.

I was thinking of using something like this:

Rows("20:30,40:50").EntireRow.Hidden = True
If Target.Address="'Worksheet1'!A1" Then
If Target.Value = "Set 1" Then
Rows("40:50").EntireRow.Hidden = False
Else
Rows("20:30").EntireRow.Hidden = False
End If
End If

I think this might work, but every time I try to run this I get various errors, like not referencing my target cell correctly.

View 5 Replies View Related

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

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 Columns With A Cell Value Of 0

Dec 13, 2003

I need help on hiding a row if a cell value is 0 in a column

View 5 Replies View Related

Hiding Columns With Dates In Any Cell

Nov 17, 2011

Trying to hide columns that have a date in any cell: cell < TODAY() Or cell - 30 < TODAY()

Code:
Dim row As Range
Dim cell As Range
Dim col As Range

Dim lRw As Long

[Code] .......

View 9 Replies View Related

Hide Columns Based On Date Value In Cell (Worksheet Change Event)

May 23, 2014

Hide Columns based on Date value in cell (Worksheet Change event)Looking for a worksheet_change event macro that will automatically hide columns based on a value in cell S3. S3 is a data validation pick list of months based on the 1st day of each (e.g. 1/1/2014, 2/1/2014, 3/1/2014, etc.). I have date columns in row 6 from columns T through AQ. These values are 1/1/2014 (T6), 2/1/2104 (U6), 3/1/2014 (V6)....12/1/2015 (AQ6). I would like to hide columns that have a date in row 6 (T6:AQ6) that is LESS THAN (<) the date in S3 after the cell is value is changed.

View 2 Replies View Related

Hiding Row Based On Cell Content?

Jul 9, 2014

I am trying to search the cells in Column A around rows 54 to 77. And if the cell says "Yes" it should hide the row. I think I'm on the right track, but can't seem to get it work.

[Code] .....

View 6 Replies View Related

Hiding CheckBox Based On Cell Value

Mar 20, 2012

Here is what I have so far (debugger highlights my CheckBoxLD.Visable arguments)

Yes, this is an activeX checkbox

Code:

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
If Worksheets("Dosing").Range("BM21").Value = 0 Then
CheckBoxLD.visable = False
Else: CheckBoxLD.visable = True
End If
End Sub

View 4 Replies View Related

Hiding Rows On One Tab Based On Value Of Cell In Another Tab?

Dec 27, 2012

I have numerous tabs in this file, but all of the tabs all summarize to the first tab called "Annual Record".

So after "Annual Record", tabs follow as "WO1", "WO2", etc...

On the tab called "WO1", I have cell AJ5, which can have 3 status selected (Data Validation List), which is either Inactive, Open, or Completed. If cell AJ5 on "WO1" says "Inactive", then I want a named range on "Annual Record" to be hidden. Right now I have the range named "WorkOrder1". This named range is essentially rows 4-7. So if it's easier to hide rows vs. a named range, then so be it. I also would like it to happen automatically (perhaps what you would refer to as a change event). When cell AJ5 is change to either "Open" or "Completed", then the rows would unhide. I'm thinking that this would be repeated for tab "WO2". If cell AJ5 says "Inactive", then rows 8-11 on the tab "Annual Record" or the named range "WorkOrder2" would be hidden. And again, if the cell AJ5 is change to anything other than "Inactive", then the rows or range would unhide.

View 9 Replies View Related

Hiding Rows Based On Value In Cell

Mar 5, 2009

I need to hide 8 rows (30-37) based on a value in cell B28.

If the value is 2 then only show rows 30 and 31
If the value is 3 then only show rows 30, 31 and 32
Then continue this up to the user puts in the value of 8 and no rows are hidden.

View 9 Replies View Related

Hiding Rows Based Upon A Cell Value

Sep 7, 2009

I'm trying to come up with some code that will hide a number of rows within the range row 7 to row 15 based upon the value of cell G1.

e.g if G1 is 1 rows 8-15 are hidden, if it is 2, rows 9-15 are hidden i.e the number of rows visible within that range equals the value of G1.

View 9 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 Rows Based On Cell Value Not Working

Jun 26, 2014

I have a macro that I am trying to add a feature to at the end of the code that hides blank rows. I have tried numerous methods based upon other forums, but my code does not seem to work and does not hide blank rows. In red is the section of code that I am having trouble with.

Sub Update()

Dim c As Object
Dim rngA As Range
Dim cc As Object
Dim AA As Range

'Check every cell in the range for matching criteria.

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

View 3 Replies View Related

Runtime Error '9' - Hiding Worksheets Based On Cell Value

May 6, 2009

I'm relatively new to this, and its entirely possibly (more likely probable) that I am attempting to this in the wrong way, but here's what I'm dealing with...

View 8 Replies View Related

Hiding / Unhiding Rows Based On Cell Input

Jul 2, 2009

I am trying to work out a macro to hide and unhide rows in worksheet 6 based on a cell input (cell I6) in worksheet 1 based on the following:

>> If I6 in Worksheet 1 = 1 or 5 or 6 then Hide Rows 19 to 24 in Worksheet 6
>> If I6 in Worksheet 1 = 2 then Hide Rows 21 to 24 in Worksheet 6
>> If I6 in Worksheet 1 = 3 or 4 or 7 then Hide Rows 17 to 20 in Worksheet 6
>> If I6 in Worksheet 1 = 8 or 9 then Hide Rows 17 to 20 and Rows 23 to 24 in Worksheet 6

View 9 Replies View Related

Transferring Columns To Another Worksheet Based On Entry In Main Worksheet?

Oct 17, 2012

I have an order form created in excel with a list of about 1600 products. I have a column set up for the customer to place the ordered amount of each product. What I need now is a way to transfer only the rows that have a value in the "ordered" column to a new sheet. I have seen it before , but don't know how it was accomplished.

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

Hiding Cells In Worksheet

Nov 11, 2008

I've created an Excel spreadsheet (Excel 7) to help me price sign printing jobs consistently. In my spreadsheet a few cells allow me to enter markups for materials & labour rates. These are used for calculating the retail price.

I would like to give my spreadsheet to some of my customers so they can calculate the retail price of a job themselves BUT, I would like to hide the contents of those few cells where I fix the markup. How can I achieve this?

View 3 Replies View Related

Hiding / Showing Columns ....

Jul 7, 2008

Here's what I'm trying to do -

There's a sheet called "Main" and 38 other sheets that shows the data (these 38 sheets all have the exact same structure/layout). Let's say these 38 sheets are called "country1", "country2", .... "country38".

Based on user input in cell J10 in "Main", I want to show only the relevant columns in all of the 38 country sheets. Specifically,

If J10 in sheet "Main" = "Option 1", hide all columns in all 38 sheets except columns A to W.

If J10 in sheet "Main" = "Option 2", hide all columns in all 38 sheets except columns Y to AU.

If J10 in sheet "Main" = "Option 3", hide all columns in all 38 sheets except columns AW to BS.

If J10 in sheet "Main" = "Option 4", hide all columns in all 38 sheets except columns BV to CQ.

If J10 sheet "Main = "ShowAll", show all columns in all 38 sheets....

Cell J10 in "Main" will be a drop down bar with the 5 choices.....

View 14 Replies View Related







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