Results 1 to 3 of 3

Thread: Adding data and delete sheets

  1. #1

    Adding data and delete sheets



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello friends

    I want add data(e.g. =sum(A1:B1) in cell C1) in all the sheets(Naming 1,2,3,....10) selecting from the master sheet containing names of sheets using vba.

    Also a program to delete those defined sheets in master.

    Thank you
    Attached Files Attached Files

  2. #2
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,058
    Articles
    0
    Button labelled Add formulae on Master sheet in attached runs the following macro:
    Code:
    Sub blah()
    With Sheets("Master").Range("A1").CurrentRegion
      For Each cll In .Cells
        Sheets(cll.Text).Range("C1").FormulaR1C1 = "=SUM(RC[-2]:RC[-1])"
      Next cll
      '.Clear 'enable this line to clear the cells containing the sheet names on the Master sheet.
    End With
    End Sub
    Button labelled Delete sheets on Master sheet in attached runs the following macro:
    Code:
    Sub blah2()
    Application.DisplayAlerts = False
    For Each cll In Sheets("Master").Range("A1").CurrentRegion.Cells
      Sheets(cll.Text).Delete
    Next cll
    Application.DisplayAlerts = True
    End Sub
    Attached Files Attached Files
    Last edited by p45cal; 2017-01-10 at 02:32 AM.

  3. #3
    Thanks a lot my friend
    Thats a big help.

Posting Permissions

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