VBA To Hide Columns On Second Sheet
Jun 4, 2009
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
View 9 Replies
ADVERTISEMENT
Dec 17, 2008
I have a speadsheet that has 27 columns for time entries, however employees seldom need to use more than the first 12 columns. I need to protect the sheet but would like the employees to be able to Unhide the columns when they need to use them, then reHide them. I can't find this as an option in either 2003 or 2007.
View 2 Replies
View Related
Sep 17, 2012
I would like to hide/Unhide last active four columns by clicking a command button.
Example:
Columns a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
When ever i click on command button for the first time, last four columns should be hidden, (w,x,y,z)
On next click, columns (s,t,u,v) should be hidden.
I want similar functionality to unhide the columns with different command button.
View 5 Replies
View Related
Feb 20, 2008
When my spreadsheet opens it automatically protects the sheets using the following
With Sheet1
.Protect Password:=SpreadsheetPassword, UserInterfaceOnly:=True
.EnableOutlining = True
End With
and I use the following to hide the column if the toggle button on my form is 'true'. The problem is it gives an error if the sheet is protected. it worksfine without protection.
If ToggleButton1.Value = True Then
Range("column_calories").EntireColumn.Hidden = True
Else
Range("column_calories").EntireColumn.Hidden = False
End If
View 7 Replies
View Related
Mar 6, 2014
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")
[Code].....
View 4 Replies
View Related
Jun 4, 2014
I have a workbook with two sheets, Project Overview and Projects Detailed. In Project Overview column K is different project numbers and what i need the code to do is when this number is pressed it has to go to Projects Detailed and search for this number in column AV and hide the lines that does not correspond with the number that has been double clicked.
In project overview you should only be able to press the numbers from row 9 and down and in Projects Detailed the numbers in column AV also starts in row 9. Some of the cells in column AV are empty and these should also be hidden.
View 2 Replies
View Related
Nov 22, 2006
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......................
View 3 Replies
View Related
Dec 21, 2011
I have about 100 products and each has its own sheet that I fill with data. Once I have finished with a sheet I rename it and create a copy and then hide the original and delete the entered data from before and start over.
Is there a way I can make it so when I hide a sheet it will automatically create a copy and delete a specific range?
View 1 Replies
View Related
Dec 12, 2013
I have a userform which clones the latest sheet and produces copy of it on the next sheet. The first sheet they will be cloning is the sheet called 'template', I however want this to be hidden since I do not want anybody to modify a sheet which basically serves purpose of a template. And once cloned, it is no longer needed.
On the click of the command button, the macro will create sheet1 taking the info from sheet named 'Template' in the same workbook . And now on the next click of the command button, Sheet 2 is created taking the info from sheet1 and Sheet 3 is created taking the info from Sheet 2 and so on. Here is what I currently have, so how can i modify it in order for my scnerio to work?
To select the last sheet in the workbook
Code:
Sheets(Sheets.Count).Select
To create new sheet
Code:
Sheets(Sheets.Count).Copy After:=Sheets(Sheets.Count)Sheets(Sheets.Count).Name = MyEvent & " " & MySCN & "(" & ThisWorkbook.Sheets.Count - 2 & ")"
View 3 Replies
View Related
Oct 15, 2012
I have a sheet named SEND FORM that has some info that I would like for the user to see for about 10sec when he opens the work book and then it will hide and show the sheet they will be working in named STOCK CUTTING FORM.. Also is it possible to have the 10 sec timer to be shown in cell L12 in the SEND FORM sheet... I already have a couple of things in my open event which are below
Code:
Private Sub Workbook_Open()
Call RunOnTime
Call ShowMsg
End Sub
View 2 Replies
View Related
Jan 14, 2013
is it possible to hide a sheet automatically if i select the other sheet. For example, I have sheet1, sheet2 and sheet3, I'm at sheet2 and if i select the sheet1, sheet2 and sheet3 will automatically hides.
View 4 Replies
View Related
Feb 18, 2014
I'm right now trying to find a way to hide a tab sheet if a cell in another sheet equals a certain value. I cant seem to find the macros for this?
Basically,
If Sheet1 cell A1 = "No" then hide Sheet 2
View 5 Replies
View Related
Jun 21, 2008
can a macro hide a worksheet if a cell in the sheet that I want hidden has a certain value?
View 9 Replies
View Related
Jan 11, 2010
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.
View 9 Replies
View Related
Feb 1, 2007
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.
View 3 Replies
View Related
Sep 12, 2007
I have found vba to hide rows that contain zero values, but not columns.
View 6 Replies
View Related
Jun 16, 2009
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.
View 3 Replies
View Related
Dec 19, 2008
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!).
View 2 Replies
View Related
Jun 11, 2009
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 ?
View 7 Replies
View Related
Nov 13, 2009
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.
View 4 Replies
View Related
Oct 23, 2002
I want to create two buttons.. one name HIDE and the other UNHIDE.
What I need hide button to do when i click it is hide the 4 columns to the right (not always going to be columns b:e)
For the unhide button unhide the 4 columns to the right (not always going to be columns b:e)
View 9 Replies
View Related
Mar 5, 2013
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.
View 4 Replies
View Related
Jun 23, 2013
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
It's not working - nothing is happening.
View 5 Replies
View Related
Jun 12, 2014
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.
View 7 Replies
View Related
May 15, 2007
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.
View 9 Replies
View Related
Apr 9, 2008
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"
Anyone know if its possible?
eg I want to hide Cols B and D
1ABCD2Shop items3dateQ1, hide meItemSupplier, hide me401/01/2006q1 2006JuicePepsi505/01/2008q1 2008crispswalkers
View 9 Replies
View Related
Sep 5, 2008
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.
Sub Macro01()
Worksheets("Input - Historical Financials").Columns("A:AD").Hidden = False
Worksheets("Input - Historical Financials").Columns("D:AD").Hidden = True
End Sub
Sub Macro02()
Worksheets("Input - Historical Financials").Columns("A:AD").Hidden = False
Worksheets("Input - Historical Financials").Columns("F:AD").Hidden = True
End Sub
View 9 Replies
View Related
Feb 27, 2009
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.
View 9 Replies
View Related
Mar 25, 2009
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
View 9 Replies
View Related
Oct 29, 2009
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.
View 9 Replies
View Related