This is a simple guide to create and assign a “button” to your simple VBA code.

Credit to WiseOwlTutorials. You can check him on Youtube

  1. Let’s create a simple VBA code in a module
  2. A simple code like this will do for our example
  3. Sub NameIsNanaKofi()
    Worksheets.Add Range("A1").Value = "My Name is Nana Kofi"End Sub

     

  4. Now let’s create an object
  5. Click on the Developer Ribbon in Excel developer-tab-insert-button-or-shape
  6. Click on the INSERT button and choose the button you like insert-button-vba
  7. Draw the button and you can rename it to any name you want and you can also resize it. create-and-rename-button
  8. Now let’s assign our macro, the one we created here : Simple Basic VBA code to our button
  9. Right click on the “button” and select “Assign Macro” assign-macro-vba
  10. choose-name-of-macro
  11. Click OK and click outside the button
  12. Now click on your button to see your VBA code executed.

Please let me know if you have any remarks , by leaving it in the comment box below.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *