Excel/VBA - Running a Macro/Userform

October 2016


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

Related :

This document entitled « Excel/VBA - Running a Macro/Userform  » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.