Excel is Only Printing the First Page of Data?

Excel would only print the data in the first page of the worksheet. The following pages would be blank, (It would print the headers for the other sheets, but not the data). The other strange thing, was that if I manually printed the document it was fine. But when I used VBA, it would not print all the data.

What Did I do to Fault Find & Try & Fix?

To try and identify the issue (when using VBA to print), I used the bare minimum code, (commenting out all the non essential code) . But it still wouldn’t print correctly. To try and identify the issue, I manually changed all the print settings to their default settings. It still wouldn’t print correctly using VBA?

I had changed the margins to a default setting, checked the page orientation and cleared the printer area using, (Page Layout > Page Setup > Print Area > Clear Print Area). It still wouldn’t print correctly using VBA. So I went into (Page Layout > Page Setup > Print Area > Print Titles > Sheet > Print Area). The print area was still set, so I manually cleared the print area . I then tried printing using VBA and it worked. It was now printing all the data, on all the pages. Yey!

So for some reason, the clear print area button was not clearing the print area? 

Additional Issues:

A little later it started playing up again! This time it was the ‘Rows to repeat at the top:, (Page Layout > Page Setup > Print Area > Print Titles > Sheet > Rows to repeat at the top:)? I cleared this parameter and it started to print correctly again, albeit with no headers? I can only presume Excel is getting confused!

Searching in Google, it appears other people having similar issues. Having to reset a lot of the print parameters in file print. Such as, Page Orientation, Scaling, etc.

What did Solve It For Me?

In the end, it looked like the worksheet was corrupted in some way. So I rebuilt the worksheet,

  • I renamed the original worksheet by putting ‘- Old’ in the name.
  • Created a new worksheet, using the same name as the original.
  • Then copied all the data across to the new worksheet.

This was the only thing that worked in the end…

The moral of the story…  To fault find. It seems the best course of action is to reset everything back to their defaults and clear any page information (for printing), in an effort to try and find the issue.

If that fails, rebuild the worksheet as described above.

I hope this helps… Smiley