Check this out

Monday 17 June 2013

Basic Macro in Microsoft Excel 2012

In this beautifull night, i was assigned to edit the excel for BCP checklist for my company. I have idea to use macro to navigate to all the checklist in an excel workbook. This below tutorial, i am creating a simple macro in Excel 2012. I want to have buttons that will navigate me through all the sheets in excel.

1. Enable developer tab
  • On the right side of the ribbon, click Action pop-up menu, and then click Ribbon Preferences.
  • Under Customize, select the Developer check box.
2. On the Developer tab, under Visual Basic, click Editor.
  • Insert a module, in the Visual Basic Editor, on the Insert menu, click Module.
  • In the code window of the module, type or paste the macro code below.
  • When you are finished, on the Excel menu, click Close and Return to Microsoft Excel.

Sample macro code:

Sub getForm()

Btn = ActiveSheet.Buttons(Application.Caller).Caption

Select Case Btn
' First section selects from the checklists
    Case "SWIFT Checklist"
        Sheets("SWIFT Checklist").Select
    Case "Infra Checklist"
        Sheets("Infra Checklist").Select
'Last section selects nav sheet
    Case "To Main Page"
        Sheets("BCP Main").Select
End Select

End Sub

Sub stands for Subroutine, which you can define for now as "macro". Running the getForm macro runs any code that is between Sub getForm() and End Sub.

3. Create 3 worksheets:
  • SWIFT Checklist
  • Infra Checklist
  • BCP main
4. In BCP main worksheets, navigate Developer ribbon
  • Insert Button
  • Change the caption to "SWIFT Checklist"
5. In SWIFT Checklist worksheets, navigate Developer ribbon
  • Insert Button
  • Change the caption to "To Main Page"
6 Now you will be able to navigate to worksheets using the button.


1 comment:

  1. wow its cool...thanks for the links being shared..thanks for the walk through too.much easier to understand now.Were basically using this in the admin departments of a web hosting atlanta company.


Popular Posts