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 , and then click Ribbon Preferences.
- Under Customize, select the Developer check box.
- 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"
Source:
- http://office.microsoft.com/en-us/mac-word-help/create-run-edit-or-delete-a-macro-HA102927318.aspx?CTT=1
- http://www.youtube.com/watch?v=H0llYIJWU3E
- http://office.microsoft.com/en-us/mac-word-help/step-3-learn-programming-fundamentals-HA104036897.aspx?CTT=5&origin=HA104036829