Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Calculating / Sorting / Printing

I have a large table of data which takes a while to update itself following
a recalculation.

My issues is that I what to print this table out after the recalculation and
after sorting the table using criteria which change during the
recalculation. I can write the code to do everything except stop the
printing occuring before the recalculation/sorting has taken place. What
comes out of my printer is the unsorted table.

How to I hold the printing process until the recalculation/sorting has taken
place?

Paul Smith



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Calculating / Sorting / Printing

Paul,

Use two macros instead of one, and fire the second one (the print part) using the ontime method,
with a suitable time difference so that the sorting is finished.

Sub ExistingMacro()
'Code here for sorting, etc.
'Then use
Application.OnTime Now + TimeValue("00:00:20"), "PrintMacro" '20 second delay
End Sub

Sub PrintMacro()
Worksheets("SheetName").PrintOut
End Sub

HTH,
Bernie
MS Excel MVP


"Paul W Smith" wrote in message
...
I have a large table of data which takes a while to update itself following a recalculation.

My issues is that I what to print this table out after the recalculation and after sorting the
table using criteria which change during the recalculation. I can write the code to do everything
except stop the printing occuring before the recalculation/sorting has taken place. What comes
out of my printer is the unsorted table.

How to I hold the printing process until the recalculation/sorting has taken place?

Paul Smith





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Calculating / Sorting / Printing

Thanks for the suggestion.

I could do it all as one macro using something like

t = Now + 20 sec
do
loop until t=

This all seems like a workaround. I am thinkin g there must be some way of
allow a recalculation to take place before progress through code.

Is this possible anyone?


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Paul,

Use two macros instead of one, and fire the second one (the print part)
using the ontime method, with a suitable time difference so that the
sorting is finished.

Sub ExistingMacro()
'Code here for sorting, etc.
'Then use
Application.OnTime Now + TimeValue("00:00:20"), "PrintMacro" '20 second
delay
End Sub

Sub PrintMacro()
Worksheets("SheetName").PrintOut
End Sub

HTH,
Bernie
MS Excel MVP


"Paul W Smith" wrote in message
...
I have a large table of data which takes a while to update itself
following a recalculation.

My issues is that I what to print this table out after the recalculation
and after sorting the table using criteria which change during the
recalculation. I can write the code to do everything except stop the
printing occuring before the recalculation/sorting has taken place. What
comes out of my printer is the unsorted table.

How to I hold the printing process until the recalculation/sorting has
taken place?

Paul Smith








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Calculating / Sorting / Printing

Paul, I think Bernie's suggestion may save a lot of pain. The alternative
might lie along the following lines:

The worksheet_calculate event fires after a sheet has been recalculated, so:
Set a Public boolean in this event to True
Get the Before_Print event to check the value of the Boolean, and set
Cancel=True if
the Boolean is false.
Set the Boolean to False in all other appropriate routines.

The tricky bit will be setting the boolean to True at the right moment. Is
there anything in your table that you could test against in the
Worksheet_Calculate event, in order to set the value
of the boolean?
The Before_Print would need to check the value of the Boolean and the Range
being printed - there may be other ranges you wish to print outside of this
control.

Just some thoughts, I hope they help. But Bernie's idea looks like a
good'n'.

Bob

"Paul W Smith" wrote in message
...
Thanks for the suggestion.

I could do it all as one macro using something like

t = Now + 20 sec
do
loop until t=

This all seems like a workaround. I am thinkin g there must be some way
of allow a recalculation to take place before progress through code.

Is this possible anyone?


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Paul,

Use two macros instead of one, and fire the second one (the print part)
using the ontime method, with a suitable time difference so that the
sorting is finished.

Sub ExistingMacro()
'Code here for sorting, etc.
'Then use
Application.OnTime Now + TimeValue("00:00:20"), "PrintMacro" '20 second
delay
End Sub

Sub PrintMacro()
Worksheets("SheetName").PrintOut
End Sub

HTH,
Bernie
MS Excel MVP


"Paul W Smith" wrote in message
...
I have a large table of data which takes a while to update itself
following a recalculation.

My issues is that I what to print this table out after the recalculation
and after sorting the table using criteria which change during the
recalculation. I can write the code to do everything except stop the
printing occuring before the recalculation/sorting has taken place.
What comes out of my printer is the unsorted table.

How to I hold the printing process until the recalculation/sorting has
taken place?

Paul Smith









Reply
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
Sorting & Calculating Scotts Excel Discussion (Misc queries) 2 July 8th 07 07:00 PM
Calculating, filtering, and sorting 5 year anniversaries? Ricter Excel Discussion (Misc queries) 6 September 27th 06 04:23 PM
CALCULATING WORKSHEETS (INCLUDING AGE CALCULATING SHEETS) FOR DOWNLOADING, GREAT FOR PENSIONS/LIFE INSURANCE CALCULATIONS! RICHARD Excel Programming 0 March 15th 05 01:41 PM
Sorting by date, then calculating totals Larry Excel Programming 0 October 12th 04 04:03 PM
Calculating pagenumbers before printing PO Excel Programming 1 February 13th 04 07:35 PM


All times are GMT +1. The time now is 12:38 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"