Solved

Apply Format Settings From Worksheet to all other Sheets in Workbook

Posted on 2016-08-03
5
52 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 12

Expert Comment

by:tel2
ID: 41741555
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 30

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41741728
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 18

Expert Comment

by:Roy_Cox
ID: 41741814
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
ID: 41743453
Thank you.  Great help as always.
0
 
LVL 30

Expert Comment

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

820 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