Solved

Apply Format Settings From Worksheet to all other Sheets in Workbook

Posted on 2016-08-03
5
54 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 31

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 20

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 31

Expert Comment

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

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

717 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