Thread: Change syntax
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ben in CA[_2_] Ben in CA[_2_] is offline
external usenet poster
 
Posts: 31
Default Change syntax - form button instead of command button

Hi Per,

Do you know how I would modify this so it could be done from a form button
instead of a command button?

(It's really useful already, but now I'm thinking it should have been a form
button.)

Also, is there any way that it could automatically replace (not ask) if the
value of C33 is 0 (zero)?

Private Sub CommandButton1_Click()

If Range("W6").Value < "" And Range("W6").Value < 0 Then
If Sheets("Quick Calculator").Range("C33").Value < "" Then
answer = MsgBox("Do you want to replace existing value for Trade
1?", vbYesNo)
If answer = vbYes Then Sheets("Quick Calculator").Range("C33") =
Me.Range("W6").Value
Else
Sheets("Quick Calculator").Range("C33") = Me.Range("W6").Value
End If
End If

End Sub


Thanks Per! - you've been a great help!

(please take no offense - in case you aren't notified of replies, I'll
re-post this as a new topic.)

"Per Jessen" wrote:

Hi Ben

Thanks for your reply. I'm glad to help.

Regards,
Per

"Ben in CA" skrev i meddelelsen
...
Hi Per,

Incredible - thanks so much!

Thanks for the super quick and super useful reply!

Ben