Last active
October 25, 2017 18:15
-
-
Save Zadigo/0aa7fc579b4256b508eb45b377799d89 to your computer and use it in GitHub Desktop.
Assigning a macro to any given shape in Excel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub assign_MacroToShape() | |
' | |
' This macro assigns a macro to a given shape | |
' | |
'Set variables | |
Dim active_Book As Workbook | |
Set active_Book = ActiveWorkbook | |
Dim active_Sheet As Worksheet | |
Set active_Sheet = Worksheets(ActiveSheet.Index) | |
Dim assignMacro as String | |
assignMacro = "'" & activeBook.Name & "'!macro_to_Assign" | |
'Assign macro | |
u.Shapes.Item(1).OnAction = assignMacro | |
End Sub | |
Sub macro_to_Assign() | |
'TO DO | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment