I have a sheet that shows multiple part numbers as the headings for the columns. The rows show each individual job/install. If there is an "x" in the column, then the part is needed and must be pulled by the warehouse. If there are no x's at all in the column, I would like the column hidden so that I can print out a concise "pick list" for the warehouse that only shows those items needed.
I've created an excel workbook to automatically create a report for my work. All you have to do is enter the data into the "DATA" worksheet. Easy. Only problem is that someone can easily ruin it if they try to run it when the "DATA" sheet is empty. I figure that if I can get two columns hide when it's empty and that would solve my problem. I've tried several VBA codes, but they don't work. Also, everything except the "DATA" sheet is protected to prevent accidently changes. This is the latest code I've tried:
VB: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "DATA!$P$5" And Target.Value = 0 Then ActiveSheet.Unprotect ("password")
I am filtering the data displayed in a chart by hiding columns. I would also like to filter the X-Axis labels by hiding columns. If I do this manually I have no problems but when I run the following macro the chart gives a reference error for the X-axis labels.
Sub ShowA2() Application. ScreenUpdating = False num = Sheets.Count Sheets("X-Axis").Activate Range(Columns(1), Columns(256)).Select Selection.EntireColumn.Hidden = False For a = 1 To 5 Sheets(num - a).Activate If ActiveSheet.Name = "A2 Data" Then Columns("A:Q").Select Range("A10").Activate Selection.EntireColumn.Hidden = False Sheets("X-Axis").Activate Columns("A:E").Select......................
I have a very large spreadsheet that I work in and then print from. When I print, I need to hide about 20 columns which I do manually. I am curious if there is a way I can do this easier. If I could somehow filter columns, or set mutliple columns to a name for a dopr dowm box, or possibly a macro.
I am trying to use an IF formula to do the following for each row in a large spreadsheet: If the value in column W = 0, show columns A,B,C and E. I have one formula I've used that doesn't work, but as posting what I think is the correct answer could get my post deleted, I won't put it here.
I've come across a spreadsheet where certain rows and columns (typically top rows or left columns) are hidden; however, there's no way to unhide them (the unhide function is grayed out) and it doesn't seem to be protected or no visible macros/vba on the file.
I have a spreadsheet that has 28 columns for time entries. Typically only the first 12 columns are used, so I would like to hide the remaining 16 columns (which makes the spreadsheet much more user-friendly). It would probably be nearly impossible to teach all of them how to Unhide the remaining columns (and re-Hide), plus I would like to use the full-screen function when employees enter thier times. I would like to use a form control in the column heading so that when the employees 'check' it, it will Unhide and then re-Hide the columns. Any way to do this? Seems like a VB thing to me (out of my league, but would be happy to add one in!).
I have created this macro (below) in a standalone spreadsheet and the expected results are that Columns A,B,C,D,G,H will be displayed after I run the macro.
But when I use the same macro in my production worksheet (columns and ranges adjusted accordingly) this macro creates the following results: Column A is displayed and all the rest are hidden (B,C,D,E,F,G,H). I am stumped as to why this occurs. Can you advice me as to how to get this macro to work and display A,B,C,D,G,H ?
I'm using Excel 2003 and want to hide columns D:E & I:J. I have script as follows which hides I:J but I am unsure how to get it to include the other 2 columns.
I once saw an excel sheet where I could hide or unhide a section by some + and - signes above the column-letters.... I have searched for this but I only get the ordinary hide/unhide solutions.
I'm attempting to put code in that will hide 2 individual columns when a particular cell in another column has no value in it. The cell, however, has a formula in it, and I'm not sure if that is my issue.
Essentially, if the formula in A32 returns a value, I need columns M and P to Hide. If it doesn't return a value, I need them to stay put. The value returning in A32 is a number, but it can be treated as text as it is an ID number and is not needed for any calculation.
Here's how I have it set up now:
Private Sub Worksheet_Change(ByVal Target As Range) If Range("A32") "" Then Columns("M","P").EntireColumn.Hidden = True Else Columns("M","P").EntireColumn.Hidden = False End If End Sub
Using VBA or by other means, I want to disable user entry in cells G1 to X1 if the user places a value in A1, similarly if the user places a value in A2 then disable user entry in cells G2 to X2, and so on.
I am using drop-down lists in a cell to filter out some data in a spreadsheet. Works great, but I would like to hide certain columns depending on which item is selected in the drop-down list. I have written a macro to do this, but I cannot get the macro to run automatically every time there is a change in the drop-down list.
The other day I had posted a thread asking if anyone could help me ensure certain columns were hidden when a .xls was opened. Here-> http://www.mrexcel.com/forum/showthread.php?t=312938
Now Id like to be able to hide the columns only if row B of the colum contains the text "hide me". Please not the cell may contain other text, such as "Q1, hide me"
My goal is to be able to hide certain columns in the workbook based upon certain criteria. Moreover, I need to be able to hide columns in a certain tab even if I working in a different tab (i.e. if I am in Tab "A", I want to be able to hit "Ctrl + Alt + X" and be able to hide columns in Tab "B").
In order to accomplish this, I selected the Visual Basic icon. I then clicked on the "Insert" drop down menu and selected "Module". I have included a sample of the code that I wrote and inserted in to the module (see below). This general pattern of code repeats itself for 16 different macros - all in this same module.
I have a list of 24 columns (12 months each for forecast and actual data). I want to put VBA code in the worksheet that will hide a column based on a cell value in each column. On line 4 there is a formula that returns either "show" or "no". The columns are AS:BP. The code needs to run on a change in any of the cells AS4:BP4.
Currently using this code to search Column D and hide if the cells are blank. How would I go about also hiding Column C as well, If D is blank?
I am using the spreadsheet as a grading template. The assignment name is under column C and the grade under column D. If there is no grade then I would like to be able to hide the unused assignment column along with the empty grade column.
Sub HideColumnsInd() With Application .EnableEvents = False .ScreenUpdating = False End With Dim rCell As Range For Each rCell In Range("D3:D48") If rCell = "" Then rCell.EntireColumn.Hidden = True Else rCell.EntireColumn.Hidden = False End If Next rCell Application.EnableEvents = True End Sub
I'm trying to hide columns M:R on sheet "1up" if cell N4 on sheet "Fill In" is blank and unhide those columns if N4 contains an "X". Columns AK:AP should also hide or unhide on "1up" if AD4 is blank or not on "Fill In".
I've pieced together the below code by recording macros and piecing together code I've found in other threads on here. I placed the code in Sheet 1 (Fill In).
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("N4").Valuse = "X" Then Sheets("1up").Select Columns("M:R").Select Range("M7").Activate Selection.EntireColumn.Hidden = True End If Sheets("Fill In").Select Range("N4").Activate If Range("N4").Valuse = "" Then Sheets("1up").Select Columns("M:R").Select Range("M7").Activate Selection.EntireColumn.Hidden = False End If Sheets("Fill In").Select Range("N4").Activate End Sub
I am trying to let Excel automatically hide unneeded columns. A brief description: In this sheet one should enter a number of "projects" into cell DW7 (7,127). The maximum number of projects is 60. Each project consists of 2 columns (with already prepared formats and functions). The projects are numbered from 1 to 60 (the actual project number is in Cell G6 (6,7), I6 (6,9)...). For this purpose I wrote the following
Sub worksheet_calculate() 'Hide columns that are not needed Application. ScreenUpdating = False Dim i As Integer Dim r As Integer i = 1 For r = 6 To 126 If Cells(6, r + i) > Cells(7, 127) Then Columns(r).EntireColumn.Hidden = True End If
If Cells(6, r + i) <= Cells(7, 127) Then Columns(r).EntireColumn.Hidden = False End If..................
I have a spreadsheet that is updated monthly. THe spreadsheet has a column for each month of the year, plus other columns. I would only like to display the current month and all past months - with the future months being hid from view. SO each time the user opened the file all headers with future dates will be hidden from view. I only would like to see the past months and other other no date column information. Is this possible to do in excel?
Hide values in Column layout on pivot table i only want to show th total value as its based on quarter figures not per month and this way it looks like Quarterly totals are broken down per month and has to have 200 a mont whenits in fact 200 for the complete quarter, how can i had the 200 for each of the month and just have the total per country? This is what my pivot table looks like
I have a workbook comprising several worksheets and on each of those worksheets I want to hide the rows where there is a zero in each of three specific columns on any row. If there is an entry that is more than zero in any one or more of those columns then the row should not be hidden.
In the attached example I would want to hide rows 4, 8, 12, 18 and 19 as there was a zero in each of the columns C, E and F. I would not want to hide the other rows as they have a figure that does not equal zero in at least one of the columns C, E or F in the row.
a macro for making it work on just one sheet - I can write the code to make it work for each of the worksheets in the book.
I am currently using the following code to hide each row when there is no data between a certain column range. I need to add to this code so that it will also hide each column when there is no date between the row range.
Private Sub Worksheet_Activate() Dim HiddenRow&, RowRange As Range, RowRangeValue& ActiveWindow.DisplayZeros = False Application. ScreenUpdating = False For HiddenRow = FirstRow To LastRow Set RowRange = Range(FirstCol & HiddenRow & _ ":" & LastCol & HiddenRow) RowRangeValue = Application.Sum(RowRange.Value) If RowRangeValue <> 0 Then 'there's something in this row - don't hide Rows(HiddenRow).EntireRow.Hidden = False Else 'there's nothing in this row yet - hide it Rows(HiddenRow).EntireRow.Hidden = True End If Next HiddenRow Application.ScreenUpdating = True End Sub
I need a macro to go through and look at each column between and including E to AW. If it sees a 0 in the cell in row 1 then I want it to hide that column completely and go to the next column.
Im wondering is ther any possibility to filter colums. My sheet is having column headings as 1's and 0's .Columns with '0' as heading are to be hidden ..can i add any filter.
I'm looking to make a simple button that would hide a given range of columns.
This is the simplest I could find:
VB: Sub button1() Columns("AD:AE").EntireColumn.Hidden = Not Columns("AD:AE").EntireColumn.Hidden End Sub
Although this works nicely, there was another way to do it (looks more ergonomic and doesn't take up spreadsheet space). Here's a screenshot of what I mean: ColumnHide.gif