Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a spreadsheet for payroll clerks to enter daily time
in/time out information for hundreds of employees. There is a sheet in the spreadsheet for the clerks to enter the information. Another sheet then calculates the hours worked from that data and prints it out. The spreadsheet also has another sheet which contains the data for all employees entered by the clerk. I have a command button which appends the data for each employee to the sheet and then clears the input cells so the clerk can enter another employee. For the sheet with the combined employee data, I'm trying to delete all rows that are either blank or equal zero. Data is potentially in columns A through O, but the number of rows vary based on the number of employees entered by the clerk. I am using the following code to detect the first blank row, so that I can format the range and then print it. 2 questions: Is there a better way to do this other than what I've done which is loop through 40000 rows? What logic should I add to check for either nonblank or zero rows so I can delete them? I've spent a few hours trying to get this to work and am frustrated!! Private Sub Print_Compiled_Totals_Click() Sheets("Compiled Totals").Select Maxrow = 1 maxcol = 1 For Each C In Sheets("Compiled Totals").Range("A1:O40000") If C.Value < "" And C.Column maxcol Then maxcol = C.Column If C.Value < "" And C.Row Maxrow Then Maxrow = C.Row Next C ActiveSheet.PageSetup.PrintArea = ("$A$1:" + Sheets("Compiled Totals").Cells(Maxrow, maxcol).Address) ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True MsgBox "Printing Complete" Thanks. Connie |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting rows in a range using Autofilter | Excel Discussion (Misc queries) | |||
Deleting Rows using a range in Column A | Excel Programming | |||
Deleting rows to get in a format. | Excel Programming | |||
deleting rows in a non-continous range | Excel Programming | |||
deleting rows in a non-continous range | Excel Programming |