LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Deleting rows and detecting range for format

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting rows in a range using Autofilter Connie Excel Discussion (Misc queries) 3 October 17th 06 01:47 PM
Deleting Rows using a range in Column A leskoby Excel Programming 3 August 29th 05 02:22 AM
Deleting rows to get in a format. Juan Eduardo Gorigoitía Excel Programming 3 October 25th 04 11:00 PM
deleting rows in a non-continous range kiat Excel Programming 0 August 22nd 03 03:23 PM
deleting rows in a non-continous range Michael Tomasura Excel Programming 0 August 22nd 03 03:58 AM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"