Solved

Apply Format Settings From Worksheet to all other Sheets in Workbook

Posted on 2016-08-03
5
45 Views
Last Modified: 2016-08-04
I have a worksheet in a workbook that is used as a baseline and has specific formatting.  Is there simple code in vba to read the formatting :Text size, column size, row size, fonts, print settings, etc  from my baseline sheet and apply it to all other worksheets in the workbook?
0
Comment
Question by:robbdfw
5 Comments
 
LVL 11

Expert Comment

by:tel2
Comment Utility
Hi robbdfw,

I don't know about the VBA option, but have you tried:
- Selecting the entire baseline sheet (i.e. click just to the left of the "A" header and above the "1" header).
- Click the format painter.
- Select the sheets you want to reformat (e.g. click the 1st sheet tab, hold down shift and click the last in the range).
- On the sheet that's now showing, again click just to the left of the "A" header and above the "1" header to apply that format to all selected sheets.
- Check the formats have changed on the required sheets.

Seems to work for me in Excel 2007 except I don't think it's copying print areas (if that's what you mean by "print settings" - is it?).
0
 
LVL 28

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
Comment Utility
You may try something like this.....

Sub CopyFormat()
Dim sws As Worksheet, ws As Worksheet
Set sws = Sheets("Sheet1")   'Source sheet with formatting to be copied to other sheets in the workbook
sws.Cells.Copy
For Each ws In Worksheets
    If ws.Name <> sws.Name Then
        ws.Range("A1").PasteSpecial xlPasteFormats
    End If
Next ws
End Sub

Open in new window

0
 
LVL 17

Expert Comment

by:Roy_Cox
Comment Utility
It's faster to simply select all the sheets rather than Loop through them. The active sheet would have it's formats overwritten but they would remain the same anyway. You can change ActiveSheet to a specific sheet e.g. Sheet1.Copy

Sub CopyFormat()


ActiveSheet.Cells.Copy

Worksheets.Select
Range("A1").PasteSpecial xlPasteFormats
Range("A1").PasteSpecial xlPasteColumnWidths
End Sub

Open in new window

0
 

Author Closing Comment

by:robbdfw
Comment Utility
Thank you.  Great help as always.
0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
Comment Utility
You're welcome. Glad to help.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now