Automating A Macro Range To Hide Rows

Aug 17, 2006

I have a graph in Excel containing the 12 months in column 'A' and data associated with each month in column 'B'. I want to hide rows containing months which have yet to arrive (eg: if we are in August, I want to hide the rows containing September:December). However, I want to change the range of rows that I hide each month (so that when we get to September, I only hide rows containing October:December). My attempts at writing a macro to perform this automatically have failed? This is the script I have written:

fyi - RowStart is the row number associated with January, RowEnd is the row number associated with December and RowNext updates each month and is the row number associated with the next calendar month.

Option Explicit
Dim RowStart As Integer
Dim RowEnd As Integer
Dim RowNext As Integer

Sub Hiderows()
RowStart = sheets("month").Range ("A1")
RowEnd= sheets("month").Range ("A2")
RowNext = sheets("month").Range ("A3")
Sheets("month").Select
Rows("RowStart:RowEnd").Select
Selection.EntireRow.Hidden=False
Rows("RowNext:RowEnd").Select
Selection.EntireRow.Hidden=True
End Sub

View 2 Replies


ADVERTISEMENT

Macro To Hide Rows Containing Data In Range

Jul 22, 2009

I have the following Macro that hides rows that contain old dates (in column B) in a range:

View 2 Replies View Related

Macro To Auto Hide Rows In Specific Range

Jun 10, 2014

I have the following macro to autohide some rows with no data, however its remove rows starting from column A.

[Code] .....

How do i fix this to only hide the rows in the range (H4:V50)?

View 5 Replies View Related

Hide Blank Rows Within A Range

Oct 23, 2007

Can't seem to find a solution searching through various forums searches. I would like to hide all blank rows within a Named Range : Range1 (A1:E8).............

View 4 Replies View Related

Hide Blank Rows Within A Range...

Oct 26, 2007

I have this code (compliments of VBA Noob) which hides all blank rows within a range ("Range1") P16:V650. It works great in a new worksheet with little amount data, however within my heavy worksheet, it takes over a minute to compile.

View 2 Replies View Related

Hide Rows In Range With Headers

Nov 26, 2013

With my searches i manage to make this working code:

Code:

Sub Hide_Rows()
Application.ScreenUpdating = False
Dim Rng, os1, os2, os3, os4, os5, os6, os7, os8, os9, os10, os11 As Range
Set os1 = Range("B11:E63")
Set os2 = Range("B64:E116")
Set os3 = Range("B117:E169")
Set os4 = Range("B170:E222")

[Code]...

In any range (os1 to os11) all empty rows are hidden... ok! But, every range have 2 first rows as headers that i want to hide (in case of no data below) before print!

View 4 Replies View Related

Hide Rows In A Dynamic Range

Jan 17, 2007

I'm trying to hide all rows from row 3 to a variable row. I've struggled to simply select the rows that I want to hide. I have managed to select a range (containing the rows that I want to hide). I now need to select the rows contained in the range currently selected and then hide them. My code is as follows:

Sheets("Program").Activate
Activesheet.Range("B3").Select
Sheets("Program").Range("B3", ActiveCell.Offset(LastProgramRow - 10, 0)).Select
Selection.Row.EntireRow.Hidden = True

The last line of code fails. I have tried modifying it to variations of:

Sheets("Program").Row (3), ActiveCell.Offset(LastProgramRow - 10).Select

but this also fails. How can I change this code so that only the row is selected and not a column?

View 2 Replies View Related

Hide Filtered Rows In Range Of Data

Nov 13, 2011

I want to filter and then hide the filtered output in a range of data. But after I hiding, when I remove the filter, everything is there again. I don't know how to hide it even filter is removed.

View 7 Replies View Related

Hide Blank Rows In Non Contiguous Range

May 15, 2008

How do you select certain ranges in the same column to filter? The ranges I need are "c36:c50" & "c54:c68" & "c72:c87" & "c91:c155" & "c158:c172" & "c176:c202" all filtering for blanks. I can not filter from c36:c202 because there are blanks in the missing rows and they have to stay.

View 7 Replies View Related

Macro To Hide Rows With 0

Nov 19, 2013

optimize the above Mcro to hide rows with "0".

Sub HideRowsw()

With Excel.Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With

[Code]...

View 1 Replies View Related

Macro To Hide Zero Rows

Jul 22, 2006

I have a series of worksheets in a single workbook. The problem is there are many rows that contain zeros across. The problem is that there is text in that row in case a number does show up there. I need a macro that will hide all of the rows containing zeros or no values.

View 2 Replies View Related

Hide Range Of Rows Based On Cell Values

Aug 13, 2014

I've been trying to put together some code to hide a range of rows on one page based on cell values on a different page. So basically Sheet1 cell A1 value is 10, A2 value is 20. When macro is run via button rows on Sheet2 from 10-20 would be hidden. The issue is the values in the cells on Sheet1 will vary. I thought something like the following would work but it doesn't.

[Code] ....

View 6 Replies View Related

Automating The Number Of Copies To Print Based On A Range

Dec 11, 2008

Automating the Number of copies to print based on a range. ihave the following

View 3 Replies View Related

Macro That Should Hide Rows Not Working Well?

Apr 17, 2014

I'm having a problem with my macro .However, if i use the following script:

[Code]......

If i am correct all the rows with a value less than 1 should be hidden right? However, some rows are hidden when they shouldn't be.

Im working on a quotation with different products in it. And the rows with a 0 in it should be hidden and that's pretty much working. But it also hides some of the subtotals(which i dont want) and some stay unhidden.

View 6 Replies View Related

Macro To Hide Rows If 0 Is In Cells

Oct 31, 2007

I just need a quick and easy macro that hides rows that have a 0 in columns H, I, J, K, or L.

View 11 Replies View Related

Writing A Macro To Hide Rows

Sep 23, 2008

I am now trying to hide rows when the data in a column matches that of a cell with a data validation list. Ideally i would like only the rows with matching data to show. When the cell is changed then the visible rows change and when the the entry "total" is selected all the rows are shown. There are several small tables of data on a page so I can't use auto filter. The data areas will also change in size as new entries are added. So the last row in the data tables will increase over time. I will copy and apply the macro to each separate table of data.

As an example cell c19 contains "lwsf"

The data table is in the range c24:q47. the column with matching data is column D so all rows of entries with "lwsf" in column D should be visible and the rest hidden. When c19 is changed to "TF" then the rows visible become those with TF in column D and the rest hidden.

View 14 Replies View Related

Any Way To Speed Up A Hide Rows Macro?

Sep 12, 2009

Does anyone know a more efficient way to run this code?

View 7 Replies View Related

Macro To Hide Rows With The Len Function

Oct 22, 2009

I have this macro hiding rows, but not the right ones. I am trying to hide all rows where the Len of a cell in column C is > 1? What am I missing here?

View 4 Replies View Related

Macro To Hide Rows Based On 'Sum'

Dec 26, 2009

I want a code to Hide the row if "sum of numbers in columns three thru last column" = 0. Following is a code I use to delete a row if that is blank. The difference here is that I dont want to to check first two columns and I want to hide them rather than deleting.

View 4 Replies View Related

Macro To Hide Rows If Cell Value Is Same?

Oct 23, 2013

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?

View 9 Replies View Related

Hide Rows Macro Crashing

Feb 14, 2014

I had this code working perfectly. However in the last 24 hours it has started freezing on me. Here is the code:

' This code will dynamically hide or unhide rows based on whether a row contains a transaction

Sub hideRows()
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False

Sheet1.Unprotect Password:="University"

[Code] .....

I call the code into a Worksheet_Change module on a particular sheet (Sheet1). It hides rows between 11 to 1503, but if I innocently select these rows, the spreadsheet freezes on me & I have to kill Excel. I'm guessing I need to add code to counter these do nothing events?

View 1 Replies View Related

Macro To Hide Rows And Columns

Aug 1, 2008

The macro code that will populate and input box and ask you which range of columns and range of rows you wish to hide, hide the columns and advise you via a message box that it has been completed

View 9 Replies View Related

Error With Hide Rows Macro

Apr 17, 2009

Im trying to use the following code to hide rows on my sheet however its just crashes my sheet:

Private Sub CommandButton2_Click()
Dim Ws As Worksheet
BeginRow = 1
ChkCol = 6

For Each Ws In Worksheets
EndRow = Ws.Range("AW" & Rows.Count).End(xlUp).Row
For RowCnt = BeginRow To EndRow
Ws.Cells(RowCnt, ChkCol).EntireRow.Hidden = Ws.Cells(RowCnt, ChkCol).Value = "Open"
Next RowCnt
Next Ws
End Sub
Basically, from row 3 onwards I want to hide rows where AW does not contain 'Open'.

View 9 Replies View Related

Macro Hide / Show Rows

Jul 2, 2009

I'm trying to create a macro that will hide all the rows where the value in column E is equal to zero.

I'm currently using rows 1:700, but I may add to it.

View 9 Replies View Related

Hide Unhide Rows Via Macro

Feb 26, 2010

I have a workbook that has 500 rows. In order to be able to print the spreadsheet, I have added a Macro in that hides any rows that have a "0" in the A column. I then put an if/then formula (ex. if(isblank(A5),0) so that if the cell was blank and 0 would be there and therefore the row would be hidden.

The problem now is that I want a new row to become unhidden everytime the row above has data in it. So, if row 5 gets data put into it, row 6 would become unhidden. The problem I'm running into is that the data in column A is peoples names, and therefore each row will have a different name (i.e. different data).

1. Is there a macro to do this?

2. (This may be a really stupid question, but...) Can you run 2 macros in the same sheet?

View 9 Replies View Related

Automating A Macro To Run On A Daily Basis?

Dec 5, 2008

Is there any way of automating a macro to run on a daily basis?

View 9 Replies View Related

Vba To Select Colored Tabs And Hide Empty Rows Within Range In Each Tab?

Jun 23, 2014

I need to select all yellow tabs (color code 6) in a workbook with over 70 tabs and hide all empty rows within A1:I36 on each of these yellow tabs. the position of the tabs needs to be unchanged (sorting by tab color not allowed). I got this code from another excel forum but somehow it only works when i select one yellow tab and run it and the code only works on the one yellow tab i selected. can fix this code so that it can loop through all tabs (yellow and non color) and do what i mentioned above for each yellow tab?

Sub HideMT()
Dim Ws As Worksheet
Dim wsColor As Long

[Code].....

View 2 Replies View Related

Macro Button - Auto Hide Rows

Mar 18, 2014

I'm trying to find a way of hiding every sixth row on my sheet, however, no matter what i try I can't seem to get it to work.

I want to be able to click a macro button that will auto hide every sixth row. But I don't want to have to input every row reference in VB.

View 5 Replies View Related

Fast Macro To Hide Empty Rows

Mar 22, 2014

Im looking for a macro that hide empty rows. I found some simple macro but that are long to execute. While looking for a faster code, I found two codes that work pretty fast. But as I don't understand VBA I am not able to adjust them to my situation.

First macro: I am able to specify my range (B6:B77), but the macro applies to blank cells and I need to apply to "" cells.

[Code] .....

Second macro: very fast as well. Here, it applies to "" cells, but I am unable to specify a range. So the rows 1 to 4, which are empty, are hidden but should not.

[Code] .....

View 11 Replies View Related

Macro To Delete (not Hide) Rows And Resort

Sep 28, 2009

I've attached a worksheet with two tabs, "before" and "after".

(a) delete the contents of rows in column "C" which <> 0.
(b) resort the data according to date under column "J" (oldest to newest)
(c) retain the integrity of column "W" which is a running total.

I do not want to hide data. I have too much of it, and I also need to use relative formulas on the sorted data (for example, a running total). I've seen other solutions in this forum for deleting rows etc. but it seems that most of them involve "hiding" information, or using filters which will make it difficult to retain the integrity of forumlas elsewhere on the worksheet.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved