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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

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