ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy format to new sheet (https://www.excelbanter.com/excel-programming/428056-copy-format-new-sheet.html)

J.W. Aldridge

copy format to new sheet
 
This code works fine... Just need to add second command to also copy
format of Range ("a14:f44")
from "Ind Templates" to new sheet.



Private Sub Workbook_newsheet(ByVal Sh As Object)
Sheets("Ind Templates").Range("A1:f13").Copy Sh.Range("a1")
End Sub



Dave Peterson

copy format to new sheet
 

Option Explicit
Private Sub Workbook_newsheet(ByVal Sh As Object)

with workSheets("Ind Templates")
.Range("A1:f13").Copy _
destination:=Sh.Range("a1")

.range("a14:f44").copy
sh.range("a14").pastespecial paste:=xlpasteformats

end with

End Sub

I made some minor changes that don't matter, but that I find makes the code
easier to read.



"J.W. Aldridge" wrote:

This code works fine... Just need to add second command to also copy
format of Range ("a14:f44")
from "Ind Templates" to new sheet.

Private Sub Workbook_newsheet(ByVal Sh As Object)
Sheets("Ind Templates").Range("A1:f13").Copy Sh.Range("a1")
End Sub


--

Dave Peterson

J.W. Aldridge

copy format to new sheet
 
worked GREAT!

thanx!


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com