#1   Report Post  
Posted to microsoft.public.excel.misc
Mike
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Mike
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Message Input with link to different work sheet KPM New Users to Excel 0 February 4th 06 05:20 PM
Message Input with link to different work sheet paul New Users to Excel 0 February 4th 06 02:59 PM
the last sonic message of OUSSAMA BEN LADEN dogy Excel Discussion (Misc queries) 0 January 30th 06 02:34 PM
Macro warning (upon opening) Richard Excel Discussion (Misc queries) 4 February 18th 05 10:43 PM
Pivot Table not valid error message when formatting data 'button'. MDW Excel Discussion (Misc queries) 0 January 27th 05 03:01 PM


All times are GMT +1. The time now is 03:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"