I have formulas in cells B8:B365 that pull project names (in words) from a plugin using values specified in other cells (non-formula). If a project is inactive, the cell returns a 0.
I am looking for a macro that will hide the rows in this range where the B cells = 0. If there is no data at all, I want to leave the row as-is (unhidden). I also have 2 other specific sheets in the workbook that I'd like to include in the formula without having to repeat the macro 2 other times.
The one I am currently using just hides every row, regardless of if there is a title, a 0, or nothing. Here is the code (I don't know how to create those nifty little text boxes):
I paste new data into a sheet of a monthly report I prepare. For this sheet, the # of data rows change (and is unpredictable) every month. I need the value inside a specific cell that dynamcially moves up and down based on the # of rows for that month (because it's below the rows of data).
So I made a formula to identify the exact cell # every month.
Example:
This month the exact cell is F255 in the "Refi" sheet.
So my formula in the "Summary" sheet cell A1 first finds the cell row # only (255) and since it's always column F, in B1 I have
VB: ="F" & (A1)
This outputs "F255" in B1, successfully identifying the target cell.
Now how do I write a formula in C1 to grab the value from whatever cell is named in B1. (For this month, the value in cell F255 from the "Refi" sheet)
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 am using the formula =IF(ISNUMBER(SEARCH("v",A2)),"OK", "Not OK") to say if cell a2 contains the letter v, then return ok. It would be really helpfull if I could say : if cell a2 contains the letter "v" or the letter "w" or the letter "x", then return ok.
How would I write a macro to hide a range of rows If a cell value is zero, then do the same for five additional ranges of rows?
In my words: If AT214=0, hide rows 214 to 244 and If AT245=0, hide rows 245 to 278 and If AT279=0, hide rows 279 to 311 and If AT312=0, hide rows 312 to 344 and If AT345=0, hide rows 345 to 377 and If AT378=0, hide rows 378 to 410
What i want to is add some code into a worksheet where it hides rows 5:35 and shows rows 37:47 if the value of cell C3 = "Races" but shows rows 5:35 and hides rows 37:47 if the value of cell C3 s not "Races".
I've got a pivot table with about 40,000 rows. I want to be able to type a part number in cell A2, and hide all rows from row 7 down that do NOT contain that number in column A.
The idea is to show only the data for the number entered, but by typing the number rather than using the checkboxes to select it.
I Have Values in Cells A29 thru F45. I want to hide the entire row if the value in Column C is the same as the value in Column C in the row directly above, i.e, if the value in C30 is the same as C29, Row 30 should be hidden.
Based upon the logic built into the table values. if the value in C30 matched C29, all of the values from C30 thru C45 would match C29 with a need to hide all rows starting at Row 30 and then thru row 45. The values could begin repeating at Cell C31 with the value in C31 matching C30 with a need to hide from row 31 thru 45.
I am thinkin a Selection.AutoFilter type of macro?
I am trying to auto hide rows in a spread sheet. the start row will always be 55 and the end row will be 55 + the value of cell A38 in sheet titled "Main".
In this example on Sheet 2, I'm trying to hide rows 1-6 if 'E6' is 0, and hide rows 15-26 if 'E18' is 0. These cell values are equal to the same cell in Sheet 1.
I've tried different codes I've found online, but I'm not very experienced with VBA so I can't get it to work. I can get rows 1-6 to hide, but it doesn't do it automatically whenever a zero is inputed into Sheet 1. It only works if I enter something into another cell on Sheet 2.
VB:
Private Sub Worksheet_Change(ByVal Target As Range) If Range("E6") = 0 Then Rows("1:6").Select Selection.EntireRow.Hidden = True
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.
I am creating a copy of a spreadsheet (table format) in a separate workbook using formulas that will update the copy as the original updates. I would like to auto hide the rows that have the value "Returned" in column G. I have columns A - G , rows 2 - 2000. The value "Returned" is the result of a simple = formula. Is there some way to accomplish this?
I'm trying to create a table that adjusts dynamically to how many cells in a row have text in them. In other words, when a cell is left blank, the entire row should not appear in the table.
I've tried the following code:
Sub test() Dim i As Integer Dim nrrows As Integer
[Code]....
When I run this code, it hides all rows, even the ones that aren't blank. why this might happen and how I can make it work?
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 read other posts about this but I am still a little confused as most macros that have been made are tweaked to suite the users individual needs.
What I want is something like this to work in the active sheet:
If cells D2:D55 = "" Then Hide.EntireRow
If cells D2:D55 = "has any value" Then Show.EntireRow
The values in D2:D55 are populated by a VLOOKUP depending on what someone chooses in a drop down validation list, however not all the rows are always required so I would like to hide them to save some space on my form.
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 need to hide rows based on a cell value. In cell B4 I list how many students are in period one.
I have enough rows for 35 students found in A10:A44. In C10: C44 I listed numbers 1-35.
So I need any row that has a number in the C column higher than what was entered in B4 to be hidden, but when cell B4 changes I need rows to unhide if their row is less than new value.
I've attached a screenshot to illustate what I am doing and a one tab version of the workbook. I've had to do it in a zip folder as they were too big individually.
I've got a table that starts at row 12 and finishes at row 217 and the users enter information into the rows over a year. The creator of the sheet has set it up so there is a "z" in the second cell of each row and as this cell is overtyped with the new information the row changes colour and is included in the selected print macro that is set up.
I want to add in a macro that changes the row height to 0 based on the "z" being present in the row above 2nd cell. So all that is showing in the table are the rows that have info in them and one blank one underneath. So everytime a new row of info is entered either a new line will reveal itself underneath or there is a control button on the sheet that the user can press to reveal a new empty line.
I don't know how to write VB, but I've found some code online that claims to do what I need, but I need it to be altered to use the presence of the "z" in the row above (2nd column) as the trigger for the rule:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Value = 1 Then
Rows(Target.Row).RowHeight = 0
Else
End If
End Sub
Or should I be starting off with minimised rows and changing it so the height increases as the "z" in the row above is overtyped?
Can this happen automatically as the z is overtyped or does the macro need to be triggered by a control button for example?
Is there a better way to do this? I don't want to get rid of all the extra empty rows and have a macro to create a new row for 2 reasons: 1.They have formulas and macros running set up by the creator that I don't want to mess with and 2. There are 52 sheets in the workbook, 1 for each week of the year and the next sheet takes the information from the previous weeks sheet so on the last sheet, number 52, it has every line that has been entered over the year from week one to week 51 carried over. If I created a new row on week2, I would have to then create that row on every sheet following week 2 and I think that would make it more complicated. I would need the macro to be able to run on any of the 52 sheets.
Private Sub Worksheet_Change(ByVal Target As Range)
I'd like to hide rows based on the value of a specific cell (that specific cell will always be C14, and it will have up to 8 variables selectable from a drop down list).
For example, if C14 = Innovative/exploratory, i'd like to hide rows 15-45. If C14 = Technical Service, i'd like to hide rows 15-32, and 42-44. I'm not familiar with VB, but am a quick study -
I am trying to run a macro that will hide rows when one cell is empty and another is not. Example: hide row when cell g is empty, but cell b is not. Or something to that effect. So far I've only used this code, but I would like to know how I can modify the code to fit the parameters I need:
Sub HideRows() On Error Resume Next With Range("B1:B300") .EntireRow.Hidden = False For i = 1 To .Rows.Count If WorksheetFunction. Sum(.Rows(i)) = 0 Then .Rows(i).EntireRow.Hidden = True End If Next i End With End Sub