Adding data and delete sheets

Sahil1390

New member
Joined
Nov 14, 2016
Messages
62
Reaction score
0
Points
0
Location
India
Excel Version(s)
2007
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
 

Attachments

  • Book1.xlsx
    11.3 KB · Views: 18
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
 

Attachments

  • ExcelGuru7186Book1.xlsm
    25.4 KB · Views: 6
Last edited:
Back
Top