I’m trying to get started with VBA for Excel and have added the “Developer” tab to the ribbon. I have also in Module1 added a small sub:
Sub Hello()
MsgBox ("Hello world!")
End Sub
Then I’ve created a button in spreadsheet 1, right click and assigned Hello as it’s macro.
By now I’m thinking this should work, but when I click on it nothing happens.
Further more, if I open the VBA editor window again Module1 have been edited, not also containing my actions?
Sub Hello()
MsgBox ("Hello world!")
End Sub
ActiveSheet.Shapes.Range(Array("Button 2")).Select
Selection.OnAction = "Hello"
Range("G15").Select
ActiveSheet.Shapes.Range(Array("Button 2")).Select
Application.Goto Reference:="Hello"
Whats this mambo jambo? And why does the button not work? 🙁
And try the messagebox without the parantheses, only the quotes. So: msgbox “Blabla”
Delete the code after the sub routine: it was accidentally generated by the macro recorder (without a purpose).