VB & BUTTONS

petersond

New Member
Joined
Aug 5, 2007
Messages
13
can anyone help me run this code when I press a form button Instead of when there is a change?

Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$Q$10" Then Exit Sub
If Range("Q10") < 75 Then
MACRO1
Else
MACRO2
End If
End Sub

thank you & brgs
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
you have a form?

in VBE just double click the button

then paste the above code. minus the sub title

or if its on a spreadsheet you have to be in design mode

view visual basic toolbar and click on design mode or add a button

then double click it and paste
 
Upvote 0

Forum statistics

Threads
1,218,620
Messages
6,143,521
Members
450,492
Latest member
Rusbus1972

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top