How To Unhide Columns
Aug 13, 2012I want to unhide columns K:DY if cell B2 = ALL, if cell B2 is something other than ALL, hide columns K:DY.
Is there any VBA code for that.
I want to unhide columns K:DY if cell B2 = ALL, if cell B2 is something other than ALL, hide columns K:DY.
Is there any VBA code for that.
The workbook contains 5 worksheets, 4 of which will unhidden just fine; the remaining worksheet ("AnnualBudget" refuses to unhide columns AD to IV. Of course, this is the sheet that contains data in those hidden cells and I cannot get to the data. The sheet is unprotected and all freeze panes removed.
I have copied this sheet to a new sheet in the same workbook:
If I copy only formulas and number formats, the new sheet has all columns unhidden. If I copy formats, I have the same issue with the new worksheet. It’s like these columns are forever locked from view.
FYI I am using Excel 2007 with a 2003 compatability worksheet
A copy of the workbook is attached. Any idea what’s happening?
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 RelatedI 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 RelatedI 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)
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 RelatedI have on sheet1 a number (72 at the moment) of Form CheckBoxes.
In simple terms: I would like a macro to look at each CheckBox and remember its state (Checked or Unchecked)
Then, go through and Check All checkboxes
Call MyMacro
Once MyMacro is complete (Filtering & Printing)
Revert the checkboxes to their original state.
The purpose of the checkboxes:
When Checked column on sheet2 is UnHidden
When UnChecked column on sheet2 is Hidden
Or, UnHide All columns on sheet2, run MyMacro, then "re-hide" the columns that were previously hidden.
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
I have a single button I want to use to call a macro to:
1.Hide columns C:AZ if they arent already hidden
2.Unhide columns C:AZ if they are already hidden.
I want to set up a macro that will hide and unhide columns.
View 9 Replies View RelatedThe code below if I run once Hide the Range("H:FV,GG:IV") and shows the Range("A:G, FW:GF") And if I run it again Unhide the Range("H:FV,GG:IV") And Show all columns
Code:
Sub Hide_Unhide()Range("H:FV,GG:IV").Select
If Selection.EntireColumn.Hidden = True Then
Range("H:FV,GG:IV").EntireColumn.Hidden = False
Else
Range("H:FV,GG:IV").Select
If Selection.EntireColumn.Hidden = False Then
Range("H:FV,GG:IV").EntireColumn.Hidden = True
End If
End If
Range("A1").Select
End Sub
Above code is working with 2 cases now is it possible to add 3rd case Hide Or Unhide Range("H:GG,GI:HJ,HO:IV") in the same code, and shows the Range("A:G, GH, HK:HN")
Resume: my request
Step1-if I run macro First time it must Hide Range("H:FV,GG:IV") and shows the Range("A:G, FW:GF")
Step2-If I run macro Second time it must Hide Range("H:GG,GI:HJ,HO:IV") and shows the Range("A:G, GH, HK:HN")
Step3-if I run macro third time it must show all columns
And repeat same cycle all time Step 1 to 2, Step2 to 3 and Step3 to 1
I have a worksheet with a fair amount of data. It is split into two parts: the main part is a table with data in columns D to AR while the other part is simply a list with checkboxes against each item. I have set things up so that when a checkbox is ticked against an item in the list, then a 2 appears in row 2 above the relevant column in the main table; if the checkbox is unticked then a 2 appears above the relevant column.
What I seek is a macro that will hide all columns that do not have the associated item ticked; in other words, I want columns to be hidden if there is a 1 in the relevant cell in Row 2 (and visible if there is a 2 there).
I have used the following code (obtained from this forum), but it doesn't work as expected. When I select the items, the cells in Row 2 react as expected, but the hiding and unhiding only occurs when I go to another Worksheet and then return to the Worksheet where the data is. Obviously I want the macro to work immediately I tick or untick a checkbox. What is wrong with the code I have used?
Private Sub Worksheet_Activate()
Call HideCols
End SubSub
[Code]....
I need to perform an action (unhide all columns) whenever I switch to a different worksheet.
Detail: I have a file with 2 tabs (worksheets). Tab 1 contains daily data, and when people are done with the current week they group and hide the columns for that week. This allows them to only view the new week and do an easy copy/paste into other applications. Tab 2 totals up the daily data from Tab 1 and shows monthly totals. The problem is that when they hide Tab 1 columns for past days, the formulas in Tab 2 don't "find" that hidden data. I would like to write a basic code that unhides all Tab 1 columns when I switch to Tab 2 so the formulas on Tab 2 reflect accurate totals. My thought is that it would be Worksheet code on Tab 1 using "Deactivate". I've tried to piece together different bits of code but can't get anything to work properly. I don't want them to have to run a macro or click a button, I'd like it to be automated when they switch tabs.
I have a sheet that upon opening a macro runs to hide a selection of columns based on cell containing certain words (see here).
I now also require the workbook to be protected so that the hidden columns (which Im sure are locked as default when hidden) are locked as are columns N & S. Now, I know I can do this by protecting the sheet and unprotecting the columns I require (ie N & S - with the hidden cells remaining locked anyway).
The issue is, every time the workbook is opened this protection must be in place.
However, I require a button, which could simply reside in A1, that when pressed, will unhide and unlocked all cells. - This is needed as its vital I can easily copy rows to another sheet (and delete from existing sheet) as and when required.
if possible, re-pressing the button would hide and proetct the worksheet however this is not too significant as long as when I close and open the workbook everything is hidden and protected as specified above.
There is no need to password protect anything.
I'd like a macro that can hide/unhide certain columns. At the moment, the columns I want to hide/unhide are F, I, M, P, U and Y.
View 4 Replies View RelatedI have a range of columns ( J:AH) which i have to hide from the user interface.In order to unhide, the editor must enter a password. He/ She can only enter the password thrice. After 3 times, if it is still wrong, the whole workbook must be closed. Is this possible? If not, I'll settle for something less complicated.
View 9 Replies View RelatedI need hide/show some column by using Macro Button. I have attached the excel sheet( name VBA testing.xls). I need to hide column K,L,N,O & visible column G,H by clicking button "Plan A".Similarly i need to hide the column G,H,N,O & unhide the column K,L by clicking the button "Plant 2. Similarly by clicking the Button "Plant 3", hiding the column G,H,K,L are needed whereas column N,O will be unhide.
View 7 Replies View RelatedMy problem is that I need column B:B to hide if it's not hidden, if it is hidden to be unhidden via the textbox password box but I don't want the textbox to appear when hitting the button to hide which it does and that then causes me to have to hit the cancel button to leave the column hidden. Here is the code I came up with:
Sub PasswordBoxCode()
ActiveSheet. Unprotect ("13792468")
Columns("B:B").Select
If Selection.EntireColumn.Hidden = False Then Selection.EntireColumn.Hidden = True
If Selection.EntireColumn.Hidden = True Then PasswordBox.Show
ActiveSheet.Protect ("13792468")
Range("A1").Select
End Sub
And then for the userform code I have this:
Private Sub CommandButton1_Click()
If TextBox1.Value = "1379" Then
ActiveSheet.Unprotect ("13792468")
Columns("B:B").Select
Selection.EntireColumn.Hidden = False........................
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 Relatedworksheet I am working on at the moment, basically if row 5 has a 0 displayed I want that column to hide, but if row 5 has text of any value displayed I want it to unhide, the range is E5 to BA5 across.
I have draft VBA code as follows:
I'm looking for a macro to hide and unhide columns..
Book1 is where I want my macro to sit with 1 cell showing the period number 1-12.
Book2 is where my data is dispalayed (I've got about 44 of these to update)
B4:M4 in book 2 (and all data sheets) has the period number in it.
I would like to be able to update the period in book1, run the macro, and end up with book 2 showing column A, the current period column, column N.
I'm fairly new to writting macro's and think I'll be able to addapt the formula to work for 44 sheets once I have it working for 1!
Need a macro for each button.
The sheet will be protected with a password (in the future, users will have varied access privileges).
Column A is designated as the "Button" Column.
There are 5 buttons here. Each representing the area on the sheet that needs to be viewed. Once the button is pressed, it takes you to that section of the sheet. At this time, I have designated each column area as:
a-z
aa-az
ba-bz
ca-cz
da-dz
I have tried this formula with opening tabs, but this won't work.
I need to write a macro that will hide and unhide columns based on a cells value. I know how to write it to hide and unhide rows, but i can figure it out for columns.
For the rows I am using the following:
Sub HideRowsSavings()
Dim LR As Long, i As Long
Application.ScreenUpdating = False
With Sheets("Savings #4")
LR = .Range("A" & Rows.Count).End(xlUp).Row
[Code] ......
I have a spreadsheet with all 365 days of the year in row 20 along 365 columns. I have buttons for each month of the year.
The days of the month are signified along row 20 from cell "H2" onwards as 1-Jan, 2-Jan, 3-Jan and so on until 31-Dec.
When I click on the "June" button (or any of the buttons with the month) I would like the columns with all the days from that month to unhide.
I have a macro that allows me to select a range of columns and unhide any that are hidden. I am on the sheet "Employees", but the action happens on the sheet "Enter". I can run this macro when I am on "Employees" and jumps top "Enter" and works exactly as I want it to.
Code:
Sheets("Enter").Select
Columns("B:T").Select
Selection.EntireColumn.Hidden = False
Range("M8") = Sheets("Employees").Range("B5")
Range("I7").Select
But when I try to run it as part of another macro that begins on "Employees", I get "Run-time error '1004': Select method of Range class failed", and Columns("B:T") is highlighted.
I am trying to hide or unhide columns E:BL depending if the the cell value in row 54 contains a value (Note cells in row 54 contain formulas). I have written the following code but get a runtime error on the else statement.
Sub UpdateCashflow()
Application. ScreenUpdating = False
ActiveSheet. Unprotect Password:="LD"
ActiveSheet.Select
Dim c As Integer
For c = 5 To 64
If Cells(54, c) = "" Then
ActiveSheet.Range(Cells(54, c)).EntireColumn.Hidden = True
Else
ActiveSheet.Range(Cells(54, c)).EntireColumn.Hidden = False
End If
Next c
ActiveSheet.Protect Password:="LD", DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.EnableEvents = True
'
End Sub
I have a Sheet which gathers data from another Sheet in the same Workbook, then uses that data to produce more output. However at it's smallest it is only 2 rows of data deep and 2 columns of data wide, and at it's greatest it is 100 rows deep by 48 columns wide.
I would like to display only the relevant output by "Unhiding" the completed rows and columns.
After headings etc the rows start at 28 and the columns at N.
I have written the following which works for the rows but nothing happens with the columns,
Private Sub Worksheet_Activate()
Dim MyRange As Range
Dim MyRow As Integer
Set MyRange = Range("a28")
MyRange.Select
Do
MyRow = MyRange.Row
If MyRange.Value > 0 Then
Rows(MyRow).Select
Selection.EntireRow.Hidden = False
End If
Set MyRange = MyRange.Offset(1, 0)
Loop Until MyRow = 128
End Sub...
I've attached one speadsheet :- "VBA.xls". The following conditions are to be done:-
1. When D2=1, Column "F","G" are visible & Column "I","J","L","M" are hidden.
2. When D2=2, Column "I","J" are visible & Column "F","G","L","M" are hidden.
3. When D2=3, Column "L","M" are visible & column "F","G","I","J" are hidden.
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
I have a spreadsheet with a number of sheets two of which contain tables with many columns with a date heading, I would like a means for the user to select a range of dates and for the spreadsheet to automatically hide any columns that don't fall within this range.
View 3 Replies View Related