Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
warning message
Hi In my worksheet i have 2 sets of buttons, is there a way of preventing
one set of buttons being used until one of the other set has been pressed first, maybe a warning message |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
warning message
You can set the enabled property of the second command button to false and in
the code module for the first command button you can use this to activate the button: Private Sub CommandButton1_Click() If Not Me.CommandButton2.Enabled Then Me.CommandButton2.Enabled = True End If End Sub -- Kevin Backmann "Mike" wrote: Hi In my worksheet i have 2 sets of buttons, is there a way of preventing one set of buttons being used until one of the other set has been pressed first, maybe a warning message |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
warning message
Hi Kevin thanks for reply, I have 10 buttons labelled £1, £2 £3 and so on
and then 8 buttons i need to make sure one of the 10 (£)buttons has been pressed before any of the 8 buttons, hope that makes sense "Kevin B" wrote: You can set the enabled property of the second command button to false and in the code module for the first command button you can use this to activate the button: Private Sub CommandButton1_Click() If Not Me.CommandButton2.Enabled Then Me.CommandButton2.Enabled = True End If End Sub -- Kevin Backmann "Mike" wrote: Hi In my worksheet i have 2 sets of buttons, is there a way of preventing one set of buttons being used until one of the other set has been pressed first, maybe a warning message |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
warning message
You can place those 8 buttons in an array, and then place it in the on click
event for the £1, £2 £3 buttons et al. It's not the most efficient, but it's the shortest way I can think of right now to convey how to do it. You write a single block of code in a module and then execute just that code for each of the buttons (£1, £2 £3) but I'm short on time at the moment. Hope this helps Private Sub CommandButton1_Click() Dim cmd1 As CommandButton Dim cmd2 As CommandButton Dim cmd3 As CommandButton Dim cmd4 As CommandButton Dim cmd5 As CommandButton Dim cmd6 As CommandButton Dim cmd7 As CommandButton Dim cmd8 As CommandButton Dim varArray As Variant Dim varButtons As Variant Set cmd1 = Me.CommandButton1 Set cmd2 = Me.CommandButton2 Set cmd3 = Me.CommandButton3 Set cmd4 = Me.CommandButton4 Set cmd5 = Me.CommandButton5 Set cmd6 = Me.CommandButton6 Set cmd7 = Me.CommandButton7 Set cmd8 = Me.CommandButton8 varArray = Array(cmd1, cmd2, cmd3, cmd4, cmd5, cmd6, _ cmd7, cmd8) varButtons = varArray For Each varButtons In varArray If Not varButtons.Enabled Then varButtons.Enabled = True End If Next varButtons Set cmd2 = Nothing Set cmd3 = Nothing Set cmd4 = Nothing Set cmd5 = Nothing Set cmd6 = Nothing End Sub -- Kevin Backmann "Mike" wrote: Hi Kevin thanks for reply, I have 10 buttons labelled £1, £2 £3 and so on and then 8 buttons i need to make sure one of the 10 (£)buttons has been pressed before any of the 8 buttons, hope that makes sense "Kevin B" wrote: You can set the enabled property of the second command button to false and in the code module for the first command button you can use this to activate the button: Private Sub CommandButton1_Click() If Not Me.CommandButton2.Enabled Then Me.CommandButton2.Enabled = True End If End Sub -- Kevin Backmann "Mike" wrote: Hi In my worksheet i have 2 sets of buttons, is there a way of preventing one set of buttons being used until one of the other set has been pressed first, maybe a warning message |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Message Input with link to different work sheet | New Users to Excel | |||
Message Input with link to different work sheet | New Users to Excel | |||
the last sonic message of OUSSAMA BEN LADEN | Excel Discussion (Misc queries) | |||
Macro warning (upon opening) | Excel Discussion (Misc queries) | |||
Pivot Table not valid error message when formatting data 'button'. | Excel Discussion (Misc queries) |