Code hanging for minutes

wpryan

Well-known Member
Joined
May 26, 2009
Messages
534
Office Version
  1. 365
Platform
  1. Windows
I'm grasping at straws here... I have a worksheet which works fine for a group of about 20 individuals, but there is one person who is having issues. On the worksheet is a control which does a couple of things:

- resets the visible sheets view to xlNormalView
- Loops through the workbook and creates footers for each visible worksheet
- "Exports" the workbook visible worksheets as a separate PDF file

In this guy's computer, executing the code can take like 5 or 7 minutes. In my computer it takes about 5 seconds. He told me that if he's on a wifi network and on our company's VPN, then many times the code crashes.

I asked him to step through the code to see where things are getting hung up. He told me it seems to be random. For example, the code for creating footers is:

Code:
 For Each ws In ActiveWorkbook.Worksheets
        If ws.Visible = True Then
            I = I + 1
        End If
    Next
    If I < 4 Then
        Sheets("Release").PageSetup.RightFooter = "Page 1 of 1"
        Exit Sub
    End If
    
    Sheets("Release").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
    Sheets("Summary").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
    Sheets("General Data").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
He said sometimes it goes right through, other times he needs minutes between lines. Also, silly lines like this can take 10 seconds to execute:
Code:
Sheets("Summary").Rows("17").Hidden = False
I really don't know what's going on with this guy's system. Virus? Missing library references? RAM which is going bad?
He is using a "standard issue" HP laptop, the same like every other employee in the department has. The worksheet is working fine on everyone else's...
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Setting the footers requires communication with the print drivers and is notoriously slow. Which version of Office does he have?
 
Upvote 0
Now that you mention it, there were some messages about printer on the bottom of the screen (windows screen, not the Excel screen). It was in German, which I don't understand... He's running Windows 7 with Office 2010.
 
Upvote 0

Forum statistics

Threads
1,215,357
Messages
6,124,483
Members
449,165
Latest member
ChipDude83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top