A few words of thanks would be greatly appreciated.

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

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on 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/).