Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
command button code
I have this formula in cell B9
=IF(B10="","",IF(B9="",NOW(),B9)) This puts the current time(remaining static) in B9 anytime something is entered into B10. What I would like to do is have one of the command buttons or check boxes in B10 that would trigger the action. Thanks for any help. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
command button code
Here is the coding for your button. Note that with the macro, you no longer
need the formula in cell B9: '=============== Sub UpdateTime() 'Original formula for reference '=IF(B10="","",IF(B9="",NOW(),B9)) If Range("B10") = "" Then x = "" ElseIf Range("B9") = "" Then x = Now Else: x = Range("B9") End If Range("B9") = x End Sub '=========== -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "dummy" wrote: I have this formula in cell B9 =IF(B10="","",IF(B9="",NOW(),B9)) This puts the current time(remaining static) in B9 anytime something is entered into B10. What I would like to do is have one of the command buttons or check boxes in B10 that would trigger the action. Thanks for any help. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
command button code
I'm getting a "compile error" "expected end sub". I copied and pasted your
code between : Private Sub CommandButton1_Click() End Sub Is that correct? "Luke M" wrote: Here is the coding for your button. Note that with the macro, you no longer need the formula in cell B9: '=============== Sub UpdateTime() 'Original formula for reference '=IF(B10="","",IF(B9="",NOW(),B9)) If Range("B10") = "" Then x = "" ElseIf Range("B9") = "" Then x = Now Else: x = Range("B9") End If Range("B9") = x End Sub '=========== -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "dummy" wrote: I have this formula in cell B9 =IF(B10="","",IF(B9="",NOW(),B9)) This puts the current time(remaining static) in B9 anytime something is entered into B10. What I would like to do is have one of the command buttons or check boxes in B10 that would trigger the action. Thanks for any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
command code ( GOTO command) in formula | New Users to Excel | |||
Code for my Command Button to automatically copy and insert a new | Excel Discussion (Misc queries) | |||
Command button to toggle worksheet event code on / off? | Excel Discussion (Misc queries) | |||
VBA code behind command button | Excel Worksheet Functions | |||
Command Button VBA code | Excel Discussion (Misc queries) |