Assigning Macro to Form Button

  • Thread starter Thread starter JAD
  • Start date Start date
J

JAD

Is there an alternative method to assigning a macro to s form button? The
right click and choose takes a long time when assigning over 200 form
buttons. Any help would be appreciated. Thank You, JAD
 
Your options with a form button are limited. If you were using a Control
Toolbox button then it is possible to use one button to run one of several
macros using either a select case statement or an If...ElseIf...Then
statement to run a certain macro based on a criteria. It is difficult to
make a good suggestion without more detail of what you are trying to do.
 
You could do it in code, but some way, you'd have to know which buttons get
which macro assigned.

Maybe a table on a worksheet with button names and macro names???
 
ps. Or if it's the same macro...

You could just use a single button and process the row with the activecell.
 
I can't imagine 200 separate macro buttons but one way of doing this is to
assign all to one macro that uses this idea tied to a table on a worksheet.

Sub vLookupValues()
lr = [a7].End(xlDown).Row
Application.Calculation = xlManual
sn = Application.Caller
x = Application.Match(sn, [SetupA], 0) + 3
'========= Not necessary due to sheet name macro
Sheets("Checks").Shapes(sn).Select
'Selection.Characters.Text = Sheets("setup").Cells(x, 2)
'=======
If Sheets("setup").Cells(x, 2) = "" Then GoTo nomo
Cells(lr, 2) = Sheets("setup").Cells(x, 3)
Cells(lr, 3) = Sheets("setup").Cells(x, 4)
Cells(lr, 4) = Sheets("setup").Cells(x, 5)
Cells(lr, 5) = Sheets("setup").Cells(x, 6)
Cells(lr, 6) = Sheets("setup").Cells(x, 7)
Cells(lr, 7) = Sheets("setup").Cells(x, 8)
Cells(lr, 8) = Cells(lr - 1, 8) + Cells(lr, 4)
Cells(lr, 4).Select
nomo:
Application.Calculation = xlAutomatic
End Sub
 
Back
Top