Tuesday, May 3, 2016

Excel Macro - 1

Calling Multiple Macros at  a time:

Call all macros in another macro writing in which order you want to execute.

Sub RunAll()
    Call Macro1
    Call Macro2
    Call Macro3
End Sub


When you want to replace the text after a click of a button, first create the test data in sheet2 and replace in sheet1 by clicking the button. Here assign the macro for each button in sheet1 with different set of test data available in sheet2.


Sub Replacetext()
    ActiveWorkbook.Sheets("Sheet1").Activate
    Sheets("Sheet2").Select
    Range("B3:E9").Select
    Selection.Copy
    Sheets("Sheet1").Select
    Range("B3:E9").Select
    ActiveSheet.Paste
  End Sub
For more information, you can refer to below link: http://www.excel-easy.com/vba.html