+ Reply to Thread
Results 1 to 9 of 9

macro that hides rows run slow

  1. #1
    Registered User
    Join Date
    03-01-2007
    Posts
    9

    macro that hides rows run slow

    Hello,

    I wrote a very simple macro(link to a button) that hides rows and columns.

    The macro usually works very fast (1/2 second)

    The problem is that after I print out somting it bocomes very slow
    (almost 40 seconds to run)

    The only way I know how to solve this is to close the file and then reopen it (without printing)

    here is the code:

    Please Login or Register  to view this content.
    Does this problem sounds familiar to anybody?

    I'll be most grateful to any help or suggestion.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    I can not help you as to why your macro runs slow after printer.

    Just another option suggestion

    Is the use of Autofliter an option
    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    03-01-2007
    Posts
    9
    Quote Originally Posted by mudraker
    I can not help you as to why your macro runs slow after printer.

    Just another option suggestion

    Is the use of Autofliter an option
    Please Login or Register  to view this content.
    Mudraker, thank you for your help.and it's good tip.

    My problem remained the same because I have a lot of printing to do and at the same time meny rows that I want to hide before printing (this is a big file)
    It works very fast before printing ,but after the printing somthing is slowing the macro and I suspect it related to the EntireRow.Hidden/EntireColumn.Hidden code. (The others macros I wrote that don't use Hidden character , work at the same speed after printing)

    I also searched through this forum and found another title :
    "Excel Printing Slowing down Macros - Help" (posted by mraadam)

    Unfortunately, nobody solve that question too.

  4. #4
    Registered User
    Join Date
    11-24-2006
    Location
    Bristol, UK
    Posts
    34
    Hi,

    I'm just clutching at straws here, but could it be something to do with the print-area?

    Try clearing the print-area at the beginning of the macro:

    Please Login or Register  to view this content.
    Might solve the problem

    Nick

  5. #5
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Quote Originally Posted by yoav_b
    Mudraker, thank you for your help.and it's good tip.

    My problem remained the same because I have a lot of printing to do and at the same time meny rows that I want to hide before printing (this is a big file)
    It works very fast before printing ,but after the printing somthing is slowing the macro and I suspect it related to the EntireRow.Hidden/EntireColumn.Hidden code. (The others macros I wrote that don't use Hidden character , work at the same speed after printing)

    I also searched through this forum and found another title :
    "Excel Printing Slowing down Macros - Help" (posted by mraadam)

    Unfortunately, nobody solve that question too.
    I want to understand the problem. You have an excel worksheet with hundreds of rows with some cells in col 1 having "HIDE" in them. You run the macro to loop through all the rows to check if col 1 has a "HIDE" and if does then you hide the first row. Is this what you want to do? Or do you want to hide all the rows in which "HIDE" occurs and not only the first row? Anyway after col1 and row1 are hidden by the macro you print the worksheet . I want to understand why do you want to run the macro again since the required row and column are laready hidden? Or do you mean to say that once the priting is over, you unhide the row and column and then when you run the macro again it runs slow? Or are you trying to run the macro when the excel sheet is still printing? It looks very unlikely that the macro will run slow once the printing is completely over and then you run the macro. Please describe the steps when your macro becomes slow.
    A V Veerkar
    Last edited by avveerkar; 04-10-2007 at 08:52 AM.

  6. #6
    Registered User
    Join Date
    03-01-2007
    Posts
    9
    Quote Originally Posted by avveerkar
    I want to understand the problem. You have an excel worksheet with hundreds of rows with some cells having "HIDE" in them. You run the macro so that all the rows with "HIDE" in the cells are hidden. You then print the worksheet with these rows hidden. I want to understand why do you want to run the macro again since the required rows are laready hidden? Or do you mean to say that once the priting is over then you unhide the rows and you run the macro again then it becomes slow? Or are you trying to run the macro when the excel sheet is still printing? It looks very unlikely that the macro will run slow once the printing is over and then you run the macro. Please describe the steps when your macro becomes slow.
    A V Veerkar
    Avveerkar, thank you for your interest and your willing to help. The sentence "...once the printing is over then you unhide the rows and you run the macro again... " is more likely to be my case. This file related to my work(costing tables of products). and has a lot of sheets and datas. sometimes we want to hide rows in order to see just the inportant data
    and sometimes I need to print part of the sheets (and hide lines) but most of the time there is a game with the hide and unhide function according to certain demands and rules.

    Here, I was just simplified the case into one simple macro after I isolate the broblem (in a new file with no other macros) and verified that the cause was related to the combination between ...EntireRow.Hidden=true/false and the print action- which for now I do without any specail macro( I print the classic way).

    again ,thank you for your help.

  7. #7
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Dear Yoav_b,

    This is normal in EXCEL. This is linked to your print driver. I am sure your problem will show up even if you just take a print preview and not actually print the worksheet. Once you initiate any print action, excel print driver will always internally generate printview automatically if your page break view is on. To prevent this, first just check if page break view is on. If it is, then you would have noticed that when you start afresh, excel sheet does not show those dotted lines indicating the page breaks but as soon as you take a print or take a print preview, those dotted lines appear and they stay put till you reboot the PC or you swith off page break. To switch off page break view go to

    Tools>Options>View>Page Breaks and tick this off.

    Let me know if this takes care of your problem.

    A V Veerkar
    Last edited by avveerkar; 04-11-2007 at 01:08 AM.

  8. #8
    Registered User
    Join Date
    03-01-2007
    Posts
    9
    Quote Originally Posted by avveerkar
    Dear Yoav_b,

    This is normal in EXCEL. This is linked to your print driver. I am sure your problem will show up even if you just take a print preview and not actually print the worksheet. Once you initiate any print action, excel print driver will always internally generate printview automatically if your page break view is on. To prevent this, first just check if page break view is on. If it is, then you would have noticed that when you start afresh, excel sheet does not show those dotted lines indicating the page breaks but as soon as you take a print or take a print preview, those dotted lines appear and they stay put till you reboot the PC or you swith off page break. To switch off page break view go to

    Tools>Options>View>Page Breaks and tick this off.

    Let me know if this takes care of your problem.

    A V Veerkar
    Beautiful.
    Avveerkar,thank you so much , I was about to give up. I spend a lot of time trying to solve that problem...but now,thanks to you , it works fine again...so thank you.you are the greatest

  9. #9
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Happy to know that I was of some help
    A V Veerkar

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1