Step 1: Open Excel and Press key Alt+F11. It will open Microsoft Visual Basic for Applications Window.
Step 2: Go to Insert menu and Click on Module.
Step 3: Copy below code and paste in the code window:
Sub UnhideAllSheets()
'Variable Declaration
Dim ws As Worksheet
'For Loop will find every hidden sheet in the workbook and unhide one by one all sheets. It will run untill all sheets are visible.
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
'Type the sheet name on which you want cursor active or active sheet.
Sheets("Sheet1").Select
End Sub
Step 4: Go to File menu and click on Save or press Ctrl+S.
Step 5: Go to File menu and Click on last option "Close and Return to Microsoft Excel" or press Ctrl+Q.
*** Assign Shortcut key or Button to Macro ***
Step 6: Go to Developer menu and click on "Macros". A new small window will open then click on "Option" and another smaller window will open.
Just press any key you want to create as shortcut key. For example, if you want that macro should be run by pressing Ctrl+G, then press G and click OK.
If you want to assign macro to a button then...
Step 7: Go to Insert menu and then click on Shapes and select any image you want to make it as Button and place anywhere in excel sheet.
Step 8: Right click on image button and click on "Assign Macro".
Step 9: A small window will open. Just select macro name and click OK.
Now if you will press Ctrl+G or click on button, macro will run.
***** End *****
No comments:
Post a Comment