Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mcg mcg is offline
external usenet poster
 
Posts: 18
Default sub slow down after page prview

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sub slow down after page prview

You may have noticed little dotted lines indicating page breaks after you do
File|Print (or print preview).

If your macro inserts/deletes rows or columns (or even changes heights/widths)
lots of times, then excel tries to figure out what to do with those dotted
lines. And that can slow your code down.

I do something like this to avoid the problem:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



mcg wrote:

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
mcg mcg is offline
external usenet poster
 
Posts: 18
Default sub slow down after page prview

actuallu it doesnt chang it at all...
here is my code:
Dim kom As Range
Dim wiersz As Integer
Dim zakladka As String
Dim czas As Date

czas = Now()
zakladka = A_Widownia.Range("c1").Value
wiersz = 6
For Each kom In Range("miejsca")
If kom < "" Then
' dodaje hiperlink
'komorka gdzie jest hpr ,adres hpr i wyswietlany tekst
ActiveSheet.Hyperlinks.Add Anchor:=kom, Address:="", _
SubAddress:="'" & Sheets(zakladka).Name & "'!" &
Sheets(zakladka).Cells(wiersz, 5).Address, _
TextToDisplay:=kom.Value

'usuwa formatowanie hiperlinka
With kom.Font
.Underline = xlUnderlineStyleNone
.Bold = True
.ColorIndex = 0
End With
Application.StatusBar = wiersz
wiersz = wiersz + 1
End If
Next kom

mcg

Dave Peterson napisal(a):
You may have noticed little dotted lines indicating page breaks after you do
File|Print (or print preview).

If your macro inserts/deletes rows or columns (or even changes heights/widths)
lots of times, then excel tries to figure out what to do with those dotted
lines. And that can slow your code down.

I do something like this to avoid the problem:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



mcg wrote:

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg


--

Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
mcg mcg is offline
external usenet poster
 
Posts: 18
Default sub slow down after page prview

i unchecked pagebreaks in tools-options anh it helped
thanks
mcg

Dave Peterson napisal(a):
You may have noticed little dotted lines indicating page breaks after you do
File|Print (or print preview).

If your macro inserts/deletes rows or columns (or even changes heights/widths)
lots of times, then excel tries to figure out what to do with those dotted
lines. And that can slow your code down.

I do something like this to avoid the problem:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



mcg wrote:

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sub slow down after page prview

Then I would think something like this code:
ActiveSheet.DisplayPageBreaks = False
would help in code.

Maybe inserting the hyperlink changes the style (and the font size) and that
could be the same as changing the rowheight????

mcg wrote:

i unchecked pagebreaks in tools-options anh it helped
thanks
mcg

Dave Peterson napisal(a):
You may have noticed little dotted lines indicating page breaks after you do
File|Print (or print preview).

If your macro inserts/deletes rows or columns (or even changes heights/widths)
lots of times, then excel tries to figure out what to do with those dotted
lines. And that can slow your code down.

I do something like this to avoid the problem:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



mcg wrote:

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default sub slow down after page prview

inserting hyperlinks change font style
but it does everytime i run macro
macro slow down occurs only after print preview or display page breaks
if i dont click print preview or display.. it goes very fast
isnt that strange?
mcg

Uzytkownik "Dave Peterson" napisal w wiadomosci
...
Then I would think something like this code:
ActiveSheet.DisplayPageBreaks = False
would help in code.

Maybe inserting the hyperlink changes the style (and the font size) and

that
could be the same as changing the rowheight????

mcg wrote:

i unchecked pagebreaks in tools-options anh it helped
thanks
mcg

Dave Peterson napisal(a):
You may have noticed little dotted lines indicating page breaks after

you do
File|Print (or print preview).

If your macro inserts/deletes rows or columns (or even changes

heights/widths)
lots of times, then excel tries to figure out what to do with those

dotted
lines. And that can slow your code down.

I do something like this to avoid the problem:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



mcg wrote:

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs

for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg

--

Dave Peterson


--

Dave Peterson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sub slow down after page prview

That was what I was trying to say about those dotted lines.

If you can see them before your macro runs (and don't turn that display off),
then excel will try to readjust those dotted lines to their new location--each
time you add a hyperlink.

If you add lots of hyperlinks then excel does lots of stuff it doesn't really
need to.

It seems pretty reasonable to me.



Gazeta wrote:

inserting hyperlinks change font style
but it does everytime i run macro
macro slow down occurs only after print preview or display page breaks
if i dont click print preview or display.. it goes very fast
isnt that strange?
mcg

Uzytkownik "Dave Peterson" napisal w wiadomosci
...
Then I would think something like this code:
ActiveSheet.DisplayPageBreaks = False
would help in code.

Maybe inserting the hyperlink changes the style (and the font size) and

that
could be the same as changing the rowheight????

mcg wrote:

i unchecked pagebreaks in tools-options anh it helped
thanks
mcg

Dave Peterson napisal(a):
You may have noticed little dotted lines indicating page breaks after

you do
File|Print (or print preview).

If your macro inserts/deletes rows or columns (or even changes

heights/widths)
lots of times, then excel tries to figure out what to do with those

dotted
lines. And that can slow your code down.

I do something like this to avoid the problem:

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

ActiveSheet.DisplayPageBreaks = False

'do the work

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode

End Sub



mcg wrote:

hi,
i have sub adding 180 hyperlinks
usually it takes app 2 sec to run it
but after page preview or switching to page breaks same sub runs

for
nearly 30 secs

what could be causing that?
i do not have any sub in beforeprint event
mcg

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
Page Setup SLOW trying excel 4..... [email protected] New Users to Excel 0 February 20th 08 10:54 PM
Excel commands become slow after using page preview 2luvpoms Excel Discussion (Misc queries) 2 August 21st 06 10:00 PM
One page is SO slow; I recreated, no help; what is wrong? Boston2AZ Excel Discussion (Misc queries) 1 March 9th 05 04:05 AM
slow page-break mode Excel Discussion (Misc queries) 0 January 19th 05 04:02 PM
slow page break previews chriscrisco Excel Discussion (Misc queries) 1 December 13th 04 08:06 PM


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