Sunday, May 12, 2013

Execute macro for each sheet in a workbook

Put this code in macro, it will fill "test" in each sheet of workbook. 

Sub cycle()

    Dim wk As Worksheet
    For Each wk In ThisWorkbook.Worksheets
    wk.Activate
    With wk.Range("I5")
    .FormulaR1C1 = "test"
    End With
    Next wk

End Sub

No comments:

Post a Comment

web stats