adamchicago
asked on
Apply formatting of one Excel worksheet to all BUT TWO worksheets
Experts, please help me with the code in the attached snippet that needs to apply the formatting of the worksheet "Pformat" and apply it to all other worksheets (names will not remain consistent) EXCEPT "Pformat" and "Format Sheets For Printing".
Thank you for any help!!!!
Thank you for any help!!!!
Sub Applyformats()
Dim sh As Worksheet
Worksheets("Pformat").Range("a1:ac1000").Copy
For Each sh In ActiveWorkbook.Sheets
If sh = "Format Sheets For Printing" Or sh = "Pformat" Then
GoTo skipp
Else
sh.Range("a1:ac1000").PasteSpecial xlPasteFormats
Application.CutCopyMode = False 'Clear Clipboard
End If
skipp:
Next sh
End Sub
ASKER
Thank you very much for the quick response...that fixed that part of the code but now I'm getting a Run-time error '1004' "PasteSpecial method of Range class failed" ?? ...any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Remove this line:
Application.CutCopyMode = False 'Clear Clipboard
jppinto
Application.CutCopyMode = False 'Clear Clipboard
jppinto
ASKER
Thanks
With all due respect, can you please explain me why you only accepted the solution provided by Rory?
I agree it should be a points split. I'd also love to hear the reason for the B grade.
That part I didn't noticed! I also don't understand why the B grade!?!
If sh = "Format Sheets For Printing" Or sh = "Pformat" Then
To this:
If sh.Name = "Format Sheets For Printing" Or sh.Name = "Pformat" Then