Macro to format all worksheets

chumley

New Member
Joined
Sep 1, 2005
Messages
36
Hi,

I'm looking to write a macro that will perform some simple formatting to every worksheet in a workbook. The problem I face is that the number of worksheets can vary from 1 to 200 and the names of the worksheets are also variable.

I have no clue how to go about this, could someone help me out please?

Thanks in advance.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi,

I'd like to add to this macro by including a command to unprotect each of the worksheets. I've tried adding "ActiveSheet.Unprotect" which didn't work.

Could someone please advise what I need to use instead?
 
Upvote 0
Hi,

I'd like to add to this macro by including a command to unprotect each of the worksheets. I've tried adding "ActiveSheet.Unprotect" which didn't work.

Could someone please advise what I need to use instead?

Chumley,

Try this:

Code:
    For Each ws In ActiveWorkbook.Worksheets
        With ws
            '
            '
[COLOR=blue][B]           .Unprotect[/B][/COLOR]

Markmzz
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,767
Members
452,940
Latest member
rootytrip

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