Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Post Unanswered: problem: macro that creates pages in excel

    i' try to create a macro that create 30 next pages in excel so that each new page created has certain functions.

    i can do that for 1 page, but i can't do that whit a for cycle.

    somebody can help me?

    this is the code for 1 page: i need an iteration for 30 nw pages...



    Sub NewWorksheets()

    Sheets.Add
    Sheets("Sheet1)").Select
    Sheets("Sheet1").Name = "AL"
    Range("G2").Select
    ActiveCell.FormulaR1C1 = "=RC[-3]*RC[-5]"
    Columns("G:G").EntireColumn.AutoFit
    Range("H2").Select
    ActiveCell.FormulaR1C1 = "=CEILING(R[-3]C[-3]-R1C15,R1C17)/R1C17"
    Range("H3").Select
    Columns("H:H").EntireColumn.AutoFit
    Range("I2").Select
    ActiveCell.FormulaR1C1 = "B"
    Range("I3").Select
    ActiveCell.FormulaR1C1 = _
    "=IF(OR(RC[-7]>R[-1]C[-7],AND(RC[-7]=R[-1]C[-7],R[-1]C=""B"")),""B"",""S"")"
    Range("I3").Select
    Columns("I:I").EntireColumn.AutoFit
    Range("J2").Select
    ActiveCell.FormulaR1C1 = "=IF(RC[6]=""B"",RC[1],"""")"
    Columns("J:J").EntireColumn.AutoFit
    Range("K2").Select
    ActiveCell.FormulaR1C1 = "=IF(RC[6]=""S"",RC[1],"""")"
    Columns("K:K").EntireColumn.AutoFit
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Ora"
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Ultimo prezzo"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = "Var%"
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "Volume Ultimo"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "Volume Totale"
    Range("F1").Select
    ActiveCell.FormulaR1C1 = "N. contratti"
    Range("G1").Select
    ActiveCell.FormulaR1C1 = "Controvalore"
    Range("H1").Select
    ActiveCell.FormulaR1C1 = "Time Bin"
    Range("I1").Select
    ActiveCell.FormulaR1C1 = "Lee&Ready Tick rule"
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "B Qty"
    Range("K1").Select
    ActiveCell.FormulaR1C1 = "S Qty"
    Range("L1").Select
    ActiveCell.FormulaR1C1 = "TEMPO"
    Range("M1").Select
    ActiveCell.FormulaR1C1 = "VOLUME"
    Range("N1").Select
    ActiveCell.FormulaR1C1 = "start time"
    Range("O1").Select
    ActiveCell.FormulaR1C1 = "9:10:00"
    Range("P1").Select
    ActiveCell.FormulaR1C1 = "bin interval"
    Range("Q1").Select
    ActiveCell.FormulaR1C1 = "0:30:00"
    Range("A1:M1").Select
    Range("M1").Activate
    Selection.Font.Bold = True


    End Sub

    thank you

  2. #2
    Join Date
    Aug 2003
    Posts
    106
    After the Sheets.Add, Use ActiveSheet.NAme = "myName" to rename it instead of selecting the sheet.

    I'm not sure if this is what you mean?

  3. #3
    Join Date
    Oct 2003
    Posts
    2

    Re: problem: macro that creates pages in excel

    thank you. i solved the problem

Posting Permissions

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