PDA

View Full Version : Solved: how do I have code run conditionally?



Dipwad
03-02-2008, 07:38 AM
I should have asked in my earlier post but I would like to know how to have this code run only if cell o10 in the "overview" worksheet is >0.

Thanks for any input.


Private Sub CommandButton1_Click()

Sheets("Don").Select
Application.Run "'Old Fart calculator.xls'!post"
Worksheets("overview ").Range("M10:Q10").Copy Worksheets("Don").Range("A2")
Application.Run "'Old Fart calculator.xls'!figure"
Worksheets("overview ").Select
Range("S10").Select
End Sub

Bob Phillips
03-02-2008, 07:51 AM
Private Sub CommandButton1_Click()

If Worksheets("overview ").Range("O10").Value > 0 Then

Worksheets("Don").Select
Application.Run "'Old Fart calculator.xls'!post"
Worksheets("overview ").Range("M10:Q10").Copy Worksheets("Don").Range("A2")
Application.Run "'Old Fart calculator.xls'!figure"
Worksheets("overview ").Select
Range("S10").Select
End If
End Sub

Dipwad
03-02-2008, 08:00 AM
Thanks xld....works like a charm.