My goal when the value in cell K14 is >= 149 then UnHide the worksheet called / labled "Operational"
I have written the statement below: I am not getting a debug error nor is my statement doing what I expect i am not sure what is wrong.
Sub test1 ()
If Range("I14").Value >=149 Then
Workbook.Sheets("Operational").Visible = True
Else
Workbook.Sheets("Summary").Visible = True
End If
End Sub
I also have this statement executing when the workbook opens:
Private Sub Workbook_Open()
ThisWorkbook.Sheets("Operational").Visible = False
ThisWorkbook.Sheets("Summary").Visible = False
End Sub
I would like to create a macro/vb code that will unhide a worksheet if cell value is greater than zero, or hide the worksheet if the cell value is zero.
I'm not too familiar with VB code and was wondering if this is possible? I have my doubts, since it means that the code must constantly be running in an endless loop, checking to see if the value has changed?
I have a workbook with daily sales information for each week in a period (4,5 or 6 weeks) depending on the fiscal year calendar. I have a dashboard to select the weekending date in cell D7. I used mscal 7.exe to embed the calendar. I need the date to remain the same, but want the calendar to show the current date. Cell H5 shows the current period;i.e. 1,2,3,4 etc. Cell H7 shows the week number of the period (1,2,3,4,5 and 6 for December).
I need vba code to showthe appropriate week's daily sales worksheet based on the info in cell H7 on the dashboard. The week number on the dashboard page is obtained fromthe calendar worksheet with a vlookup formula. These sheets are named "week 1, week 2, week 3, week 4, week 5 and week 6". I need to assign this code to a shape with the caption Create New Week.
I'm using column A as a reference. My data starts in cell A3.
Whenever theres a zero in any cell in column A I would like that row to hide. If the row was hidden and the value changes to any number greater than zero I need the row to unhide.
I can record two macros for the hide/unhide part of this but I dont understand how to run them based on cell value.
worksheet 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 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
I'm trying to find a way to hide rows based on a condition in one cell.
Basically I have a pull-down list with Yes or No in it. I want to hide rows 52 through 57, if No is selected, and make the rows reappear if Yes is selected.
I have a workbook which has roughly 50 sheets. What I'm trying to do is automatically hide/unhide sheets based on the cell values in the first sheet. So in sheet1 cell A1 i would a value of FALSE which would trigger sheets1, 2, & 3 to hide, when that value changes to TRUE then those same sheets would unhide. I need to replicate that for the 10 corresponding sets of sheets, but for each grouping of sheets a different cell in sheet1 would be the trigger, cell A2 = sheets 4 - 10, cell A3 = sheets 11 - 20, etc.
I have a worksheet that contains 10 columns of data. In row 2 I have a formula that will display the result "x" if the data in that column should NOT be hidden, and for all columns of data without an "x" in row 2 I would like to hide the entire column.
Therefore, I am looking for a macro that looks across the range of cells E2:N2 and if there is not an "x" in the cell, then hide that column...
To make things a little more complicated, the value in row 2 will change when other values are amended on other worksheets that feed into this one and I will need the macro to 'unhide' the column as soon an "x" appears in row 2
I realize there are many Hide/Unhide requests. Although, believe me when I state that I have checked into the matter, and tried to solve it on my own.
If any of you fine forum dwellers could point me in the right direction, I would greatly appreciate it. I am trying to achieve the following:
Two Macros: #1: To hide rows(entire spreadsheet) based on cell value in Column C (value is '0') Here is a code (from this forum) that seems to be the least complex/confusing. I don't understand the "AC2" value. Would it not be A2? Or does it signify a certain range?
Sub HideRows() With Sheets("Store Snapshot") If Range("AC2").Value = 2 Then Rows("13:15").EntireRow.Hidden = True If Range("AC2").Value = 1 Then Rows("13:15").EntireRow.Hidden = False End With 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.
I have a sheet called "Summary", there is a cell, AR8, of that sheet that is linked to other sheets. If AR8 of "Summary" has a value other than 0 I would like it to unhide. But if the value goes back to 0 again I would like it to hide itself again.
I have the following code which works perfectly. It needs to hide rows 3:60 based on the value in K2.
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("K2")) Is Nothing Then If Not IsNumeric(Range("K2").Value) Or Range("K2").Value = "" Then Range("A3:A60").EntireRow.Hidden = True Else Range("A3:A60").EntireRow.Hidden = False End If End If End Sub
The problem I am experiencing is that I want to use a formula in K2. K2 must get its value from a cell on a different sheet.
If I manually delete the value in K2 the rows hide and if I manually enter a 1 in K2 the rows unhide, however I want to enter a formula in K2 that will result in either a 1 or blank cell.
I want to hide and unhide columns based on a cell's value.
If D6 of the ‘Summary’ Worksheet Is <> to ‘Test1’ and <> ‘Test2’ THEN Hide columns D:K of the ‘Charts – Source Data’ Worksheet OTHERWISE Unhide columns D:K
I am trying to hide/unhide columns based on what is return to cell C2 from this lookup (=VLOOKUP(B2,GM!E2:M129,9,FALSE)). It can only return 3,6 or 9
If it returns 3 I want to hide columns I:P If it returns 12 I want to hide columns E:L If it returns 6 I want to hide E:H and M:P
I have been trying to work with this code which I found on this forum but I haven't been able to get it working fully. It only works when C2 is entered rather than calculated and I can't get it working for the M:P part of the third option.
Code:
Private Sub Worksheet_Change(ByVal Target As Range) Dim Changed As Range Set Changed = Range("C2") If Not Intersect(Target, Changed) Is Nothing Then Range("A:Z").EntireColumn.Hidden = False
I am trying to create a macro that will work on my master summary sheet. The sheet pulls information from other worksheets. I would like to have a macro that will look at range E7:E356. If the value is 0 then hide, but if the value changes then unhide the row. I have tried autofilter but it will not update automatically.
I have a master sheet where users can change the name of 20 different sheets in the workbook by changing a cell value on the master sheet. Here is the code:
Code: Private Sub Worksheet_Change(ByVal Target As Range) Dim rCell As Range If Target.Cells.Count > 1 Then Exit Sub
[Code]....
The next step which I am having issues with is hiding the sheets. I want all sheets in the workbook to be hidden except for the master. I only want the other sheets to be visble if the user inputs a name on the master sheet.
So if the cell contents on the master sheet, say "B9", is blank, the sheet in the workbook that corresponds to that cell will remain hidden. If the user inputs anything, say "Sheet1", in cell "B9" on the master sheet, I want that sheet to become unhidden and to be named "Sheet1"
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column <> 13 Then Exit Sub If InStr(Target.Value, "Other (specify in next column)") Then Columns("N").Hidden = False ElseIf WorksheetFunction. CountIf(Columns("M"), "Other (specify in next column)") = 0 Then Columns("N").Hidden = True End If End Sub
but I have a lot of columns that I need to perform as above and I have put the code together as below
Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next
If Target.Column = 13 And InStr(Target.Value, "Other (specify in next column)") Then Columns("N").Hidden = False ElseIf WorksheetFunction.CountIf(Columns("M"), "Other (specify in next column)") = 0 Then.................
Using the above code, when I selected more than one cell anywhere in my workbook and pressed delete I was bugging out with a runtime error 13 message. You can see from the above code that I inserted "On Error Resume Next" - this got rid of the runtime error 13 message, but now when I select more than one cell and press delete, hidden columns are incorrectly revealed in my worksheet. how I can extend the working code at the top of this posting so that it works for a number of different columns in my Worksheet i.e. without the runtime error 13 occurring and without columns being incorrectly revealed.
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?
What I am trying to do is keep a few worksheets hidden until something is entered onto that sheet using a vlookup formula.
My Setup is that we have a daily schedule that is on "sheet 1" when we enter certain items on that sheet, vlookup allows them to appear on "sheet 4". now when an Items appears on "Sheet 4" that is when we would like the sheet to become "unhidden".
Using MVB I found - Sheets("Sheet4").Visible = True
I tried attaching an IF;then statement to it referencing cell (A5) but either it doens't work like that or the code was wrong.
I put the correct cell in place $K$23, now I want to hide a worksheet called "DutyCode" when info!$k$23 is blank or has "xx" or "XX" in the cell, and then unhide "DutyCode" when the number 27 is inputed in info!$k$23
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address "$k$23" Then Exit Sub If Target.Value = 1234 Then Worksheets("Sheet2").Visible = True Else Worksheets("Sheet2").Visible = False End If End Sub
I have a workbook with quite a few worksheets, along with a summary page. The summary page has a list of names of all the worksheets in the workbook. I am still learning to use Macro. So far, I have created buttons to hide the individual worksheets (each component is on a worksheet by itself). But I can't figure out how to unhide a specific worksheet from a group of worksheets without creating just as many macros calling specific worksheet names. I don't really want to create 100s of little macros. I am sure there is a better way out there.
Here is a concept of the workbook:
On the summary page, the user supposed to click on a label ("T1000" for example), and this will unhide a worksheet with the same name (T1000). There are hundreds of these worksheets, how does it find
This is my idea of how the function supposed to work.
First determine the label text as a string. Then locate the worksheet with the name equals to the string then set visibility = true.
Within a worksheet "Page_2" I would like VBA to perform following calculation: IF(COUNTIF(R:R;1);1;2)
Basically, look into column R of worksheet "Page_2" and look if there is in the column at least one number with the value 1, if there isn't show me value 2.
Depending on the value coming out of this function, VBA needs to hide worksheet "Page_3" if the value is 2 and unhide worksheet "Page_3" if the value is 1.
Here is the code which I'm using and that is not working.
Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Application.WorksheetFunction.CountIf(Range("R1:R5000"), 1) = 1 Then Worksheets("Page_3").Visible = True
I have a protected sheet so specific people can only see certain things. I would like code to Unhide a tab called "Estimating" and unhide Rows 2 through 9 and rows 24, 26 and 27.
I want to make a hidden sheet visible. Except that i want to use the name of the sheet (the thing that stays the same even when you change the sheet tab name). I also want to select the name based on a variable called Year which the user adds elsewhere (eg as 2006).
wf = "WF_Edin_" + Year 'So for 2006 this would read WF_Edin_2008 wf.Visible = True
The above doesnt work as wf becomes a string which i dont think i want do i?