Excel/VBA - Running a Macro/Userform


I am a beginner in VBA programming and I have a worry in the execution of a macro from a user form.
  • I actually have 5 different worksheets, containing several macros attached to each of them. My goal is to create a user form with a button interface with spreadsheet so you can run the macro in the sheet I want I want. *My problem is I cannot assign to a button click (the user form) the execution of my target macro. (I do not know if this is clear ...)


The easiest way would be to put your macros in a public module by specifying the sheet on which you want to intervene.
Alternatively, declare your macro by Target.
  • Public Sub Test ()

In the Userform:
  • Private Sub UserForm_Click () Feuil1.Test 'or Sheets ("Sheet1"). End Sub Test

Note that

Solved by lermite222
Published by aakai1056. Latest update on August 13, 2012 at 10:11 AM by jak58.
This document, titled "Excel/VBA - Running a Macro/Userform ," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).
Excel - Opening multiple windows simultaneously
Excel - Recalculate workbook before saving