Guidance needed for sheet formatting macro code

Leeinsa

Board Regular
Joined
Jul 24, 2009
Messages
96
folks,

I have a workbook which processes multiple csv files and produces multiple worksheets based on the csv information. Depending on the dates selected by the user, many worksheets (30 - 50) may be produced. each of these worksheets is then formatted prior to exporting the sheets to a pdf file. The code i use to format the worksheets is below, but it runs incredibly slow, so the whole process can take upwards of 30 minutes. Does anyone know of a better or faster way of carrying out the formatting of each sheet?

Any help much appreciated.

Sub sheet_format()
With ActiveSheet.PageSetup
.RightFooter = "Page &P of &N"
.PrintTitleRows = "$1:$9"
End With
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.4)
.RightMargin = Application.InchesToPoints(0.4)
.TopMargin = Application.InchesToPoints(0.4)
.BottomMargin = Application.InchesToPoints(0.4)
.CenterHorizontally = True
End With
End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
AnAnalyst,

Many thanks for the reply, I'm sure theat thread has the right info to speed up my formatting. Will try it out later.

thanks again.

Lee.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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