Hi been a consistent user of this forum and never had the chance to ask anything. But hoping someone could help me with this. I have 4 sheets in a workbook and I want to copy and paste values a range with formating to a new workbook. I have completed the following using the record feature and modified it a bit. This works great for the one sheet that I have. But is there an easy way to apply this same code to the remaining 3 sheets?
Sub CopyWithFormatting()
Sheets("Select").Range("M1:W185").Copy
Workbooks.Add
Columns("A:AF").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With ActiveSheet.Range("B1")
.PasteSpecial xlPasteColumnWidths
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
Columns("C:C").EntireColumn.AutoFit
Columns("A:A").ColumnWidth = 2
Columns("D:L").ColumnWidth = 11.5
End With
'formating
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Select"
Range("A7").Select
ActiveWindow.FreezePanes = True
ActiveWindow.Zoom = 80
End Sub
Thanks so much for the help.
Sub CopyWithFormatting()
Sheets("Select").Range("M1:W185").Copy
Workbooks.Add
Columns("A:AF").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With ActiveSheet.Range("B1")
.PasteSpecial xlPasteColumnWidths
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
Columns("C:C").EntireColumn.AutoFit
Columns("A:A").ColumnWidth = 2
Columns("D:L").ColumnWidth = 11.5
End With
'formating
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Select"
Range("A7").Select
ActiveWindow.FreezePanes = True
ActiveWindow.Zoom = 80
End Sub
Thanks so much for the help.