Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sheet format page (2000 sr 1)

    With this code i make variuos sheet from MASTER...
    Why the sheets created from MASTER not maintain the same format of MASTER?
    IN effect MASTER have show grid, have header and bottom value, variuos alignment, ecc...
    See the attached test wbook...

    code:
    Sub CREA_FOGLI_OK()
    'CREA E NASCONDE FOGLI
    Call CANCELLA_SHEET_AGENZIE
    Dim i As Long, s As Worksheet
    Dim Column As Long
    Dim Row As Long

    Application.ScreenUpdating = False
    Set s = Worksheets("SALDI")
    ThisWorkbook.Worksheets("MASTER").Visible = True
    i = 3
    While Not IsEmpty(s.Cells(i, 4))
    ThisWorkbook.Sheets.Add
    With ActiveSheet
    ThisWorkbook.Worksheets("MASTER").UsedRange.Copy .[A1]
    For Column = 1 To 6
    .Columns(Column).ColumnWidth = ThisWorkbook.Worksheets("MASTER").Columns(Column). ColumnWidth
    Next Column
    For Row = 1 To 8
    .Rows(Row).RowHeight = ThisWorkbook.Worksheets("MASTER").Rows(Row).RowHei ght
    Next Row
    .Range("B2:F2").MergeCells = False
    s.Cells(i, 1).Resize(1, 6).Copy
    .Range("B1").PasteSpecial Transpose:=True
    .Range("B2:F2").MergeCells = True
    .Name = Mid((s.Cells(i, 3)), 1, 4) & "-" & Format(s.Cells(i, 4), "#000000")
    Worksheets(.Name).Visible = False
    End With
    i = i + 1
    Wend

    s.Activate

    ThisWorkbook.Worksheets("MASTER").Visible = False
    Application.ScreenUpdating = True

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sheet format page (2000 sr 1)

    You don't create the new worksheet from the MASTER sheet. You create a new sheet with ThisWorkbook.Sheets.Add. This is a completely blank sheet. You then copy some information from MASTER into it.

    You have received code before that shows how to copy an entire worksheet.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •