Sunday, March 13, 2016

Auto Open [Run] macro code - when workbook open

Lets have look on older post, which is showing that how to execute macro code for individual sheet of a workbook.

http://j4info.blogspot.in/2013/05/execute-macro-for-each-sheet-in-workbook.html

Earlier we were able to manage to execute macro code for each sheet available in spreadsheet or Workbook. We had achieved one task and now mind think why i need to execute macro code manually, it should be executed automatically as soon as i open the spreadsheet. I started working on this, it is well said nothing is impossible. we did this, see below.

In this post we will do workaround that how to auto open macro code and start its working after immediate open of workbook

Sub Auto_Open()
    Dim wk As Worksheet
    MsgBox "Fill Values in cell of all sheets"
    For Each wk In ThisWorkbook.Worksheets
    wk.Activate
    With wk.Range("I5")
    .FormulaR1C1 = "testqqq"
    End With
    Next wk
End Sub


USe Auto_Open() thats it....

No comments:

Post a Comment

web stats