Formatting of all sheets at a time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I am Radha krishna, I am having a doubt in Excel VBA programming. In our
work we are doing formats such as Merging, row banding, Button creation,
Print area setting, Hidding and deleting of rows and columns etc. At present
we are doing that in a for loop by selecting each sheet at a time and
applying all the formats and selecting the next sheet and do the same things.
My doubt is whether Is there any way to do these common operations for all
sheets at a time or not? If so Please help me.
 
Some things maybe, but maybe not all.

But is there a problem doing it the way that you do?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Hi all,

I am Radha krishna, I am having a doubt in Excel VBA programming. In our
work we are doing formats such as Merging, row banding, Button creation,
Print area setting, Hidding and deleting of rows and columns etc. At present
we are doing that in a for loop by selecting each sheet at a time and
applying all the formats and selecting the next sheet and do the same things.
My doubt is whether Is there any way to do these common operations for all
sheets at a time or not? If so Please help me.

Are you actually selecting the sheets within the For Loop? If so,
that is not necessary. Also, if you are selecting the cells that you
wish to format within the loop, that also is not necessary. You can
use something like:

Sub this()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Range("A1:C1").MergeCells = True
Columns(4).Font.Bold = True
Range("C5").Interior.ColorIndex = 37
Next ws
End Sub
 
The problem is its taking more time.

Bob Phillips said:
Some things maybe, but maybe not all.

But is there a problem doing it the way that you do?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
If the same cells in each sheet are formatted the same way why not group the
sheet, (using code), then make the changes in sheet 1 only to do the whole
job.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
Back
Top