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
ADVERTISEMENT
Dec 20, 2008
I have a spreadsheet that allows room for 35 students per period, but instead of having the teacher manually go in and delete the extra data and hide the rows, I want to create a macro that will do so.
In cell B4 the teacher will enter how many students are in their first period class. (cell C4 for second period, cell D4 for third etc...) I want the entering of the number to automatically hide the superfluous rows and delete the data in the second column for those rows. I don't want the rows to be completely deleted because another year they may have more students and need those rows back.
I have attached one of the workbooks that I need to put this macro into. I have created room for 35 students in a given period. So if they have 23 students entered into B4 (period one) I would need rows 30-41 to be hidden, and I would need the formulas in B30:B41, E30:E41, H30:H31, K30:K31 etc....deleted.
Basically the point of the formulas is the teacher will enter the total points possible on that given assignment in cell B6, E6, H6 etc....and it autofills that score down, so the teacher only enters those that missed points instead of entering in the missed ones and the 100 percent ones.
I would need those formulas to be deleted because if the assignment was out of 10 then cell B30-B41 will give students a 10, and then the class average will be computing those scores,but those students don't exist.
But if I can't get the macro to auto delete the formulas, I will just not have those formulas in there, and the teacher can enter all scores.
View 9 Replies
View Related
Jun 3, 2009
I need some help with some VBA to hide or delete rows that numerically equate to zero (please see attached spreadsheet template). The cells in the first two columns have text to represent categories, but all the remaining cells are numeric. If any of these are all zero I want to delete or hide the row(s) so the worksheet looks better, with less redundant info.
View 4 Replies
View Related
Jul 22, 2006
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.
View 2 Replies
View Related
Aug 2, 2008
So i don't have any events that i know of that should trigger my macros to run. But everytime i delete a cell, or hide rows, it seems all my code/macros just auto run. And i had a few times when i hid the rows, the code would start, and then my excel application would crash.
View 4 Replies
View Related
Feb 26, 2008
I would like to setup a macro that brings up a dialog box asking for a date in a specific column. Once that date is entered in the dialog box, the macro would then find all rows before that date (in that specfic column) and delete them.
View 9 Replies
View Related
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
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
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
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
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
Sep 12, 2009
Does anyone know a more efficient way to run this code?
View 7 Replies
View Related
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
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
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
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
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
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
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
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
May 10, 2012
I need a macro that can look at multiple (say three) rows and delete those rows if they match another three rows in the worksheet.
For example:
1 0
3 1
5 7
4 4
6 5
8 3
1 8
5 2
3 9
6 5
8 3
1 8
7 5
If three rows are the same, then one set is deleted (it can be either bottom or top set). I would like to do this for rows 1-500 in the worksheet.
View 1 Replies
View Related
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
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
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
Jun 17, 2003
Like to create a macro (button) to hide / unhide rows based on a cell value
Example
A1=No then hide roa A
C1=No then hide row c
View 9 Replies
View Related
Aug 26, 2009
Need a macro to hide two rows when a check box is checked? Is this even possible? I would like rows 44 and 45 to be hidden when the check box next to loan impairment is checked.
View 9 Replies
View Related
Dec 26, 2009
I want a code to Hide the row if "sum of numbers in columns three thru last column" = 0. Means, if the sum of all the cell (except first and second cells in that row) in a row is zero, then that row should be hidden.
View 9 Replies
View Related
Oct 8, 2009
I've tried using multiple loops in the forum but cannot seem to figure out how to actually get them to work properly using the conditional VBA codes on two separate worksheets. The first code snippet is checking cell values from row 6 to 148 as such:
Sub Check_Shifts()
'Insure all shift entries are completed
If Range("K6").Value < "1" And Range("I6").Value < "1" And Range("G6").Value < "1" Then
Range("G6").Value = Range("F6").Value
Range("I6").Value = Range("F6").Value
Range("K6").Value = Range("F6").Value
ElseIf Range("K6").Value < "1" And Range("I6").Value < "1" Then
Range("I6").Value = Range("G6").Value
Range("K6").Value = Range("G6").Value
ElseIf Range("K6").Value < "1" Then
Range("K6").Value = Range("I6").Value
End If
If Range("K7").Value < "1" And Range("I7").Value < "1" And Range("G7").Value < "1" Then........................
View 7 Replies
View Related
Aug 15, 2006
I have read several related threads and tried to adapt their answers to my application with no success. I am trying to write a macro that will hide rows based on that row's value in a certain column. Specifically, column AB contains sums and if a sum equals 0 I want to hide that row. The sums start at AB5 and go to AB118 but there are 4 gaps in the column at rows 25, 47, 70, and 94.
View 9 Replies
View Related
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
View Related