shahsavand
Board Regular
- Joined
- Dec 8, 2014
- Messages
- 74
I have workbook contains a lot of sheet.i wanna make all of the sheets' formating hidden only.(not locked)
Even when I create a new sheets
Even when I create a new sheets
Private Sub Workbook_NewSheet(ByVal Sh As Object)
Worksheets("Sheet1").Range("A1:F8").Copy
Sh.Range("A1").PasteSpecial xlPasteFormats
End Sub
Hi,
I am not quite sure what you mean.
However, you can paste Formats from one Worksheet to another. So you could have a Workshheet set up, possible hidden, that had the right formatting and then you could paste it over any new Worksheets when they are created. Would that solve the problem?
You could add some code to detect the creation of a new WOrksheet and apply the Formats automatically. For instance:
That needs to be placed in the ThisWorkbook module.Code:Private Sub Workbook_NewSheet(ByVal Sh As Object) Worksheets("Sheet1").Range("A1:F8").Copy Sh.Range("A1").PasteSpecial xlPasteFormats End Sub
The example copies the formats from Sheet1 in cells A1:F8 and pastes them into any new Worksheet.
Regards,
Private Sub Workbook_NewSheet(ByVal Sh As Object)
If Sh.Type = xlWorksheet Then Sh.Visible = False
End Sub
It may be the "formatting" word that is causing the confusion.
Are you saying that when you create a new worksheet you want it to be hidden? If so then try this:
Code:Private Sub Workbook_NewSheet(ByVal Sh As Object) If Sh.Type = xlWorksheet Then Sh.Visible = False End Sub