Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old May 12th 10, 01:11 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2007
Posts: 86
Default Count and Reset Button Clicks

Hello Experts.

I have a Yahtzee game with 2 buttons/2 macros.

One button (Roll Dice) rolls the dice (Calculate) and the second button
(Next Player) clears all checkboxes on the sheet.

However, I'd like to know if there's a way to disable the first button after
it's been clicked 3 times, then re-enable it once the second button is
clicked and start the count over...

Please advise.

I thank you for your time.

  #2   Report Post  
Old May 12th 10, 01:30 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 11,058
Default Count and Reset Button Clicks

We can use a Global variable to communicate between the two macros:

Dim IAmTheCount As Integer

Sub FirstButton()
If IsEmpty(IAmTheCount) Then
IAmTheCount = 0
End If
IAmTheCount = IAmTheCount + 1
If IAmTheCount 3 Then Exit Sub
'''''''''''''''''''''''''''''''''''''''''
' your stuff
MsgBox "doing button #1 things"
'''''''''''''''''''''''''''''''''''''''''
End Sub


Sub SecondButton()
IAmTheCount = 0
'''''''''''''''''''''''''''''''''''''''''
' your stuff
MsgBox "doing button #2 stuff"
'''''''''''''''''''''''''''''''''''''''''
End Sub


Once the first macro increments the count to three, it does not proceed.
The second macro clears the counter and allow the first macro to resume.
--
Gary''s Student - gsnu201002


"Arlen" wrote:

Hello Experts.

I have a Yahtzee game with 2 buttons/2 macros.

One button (Roll Dice) rolls the dice (Calculate) and the second button
(Next Player) clears all checkboxes on the sheet.

However, I'd like to know if there's a way to disable the first button after
it's been clicked 3 times, then re-enable it once the second button is
clicked and start the count over...

Please advise.

I thank you for your time.

  #3   Report Post  
Old May 12th 10, 04:23 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2007
Posts: 86
Default Count and Reset Button Clicks

Alright, Student of Gary.

I'm all excited to try this. Thanks for explaining the pieces as well.

p.s. I'll be right back if I hit any snags.

But thanks again.

"Gary''s Student" wrote:

We can use a Global variable to communicate between the two macros:

Dim IAmTheCount As Integer

Sub FirstButton()
If IsEmpty(IAmTheCount) Then
IAmTheCount = 0
End If
IAmTheCount = IAmTheCount + 1
If IAmTheCount 3 Then Exit Sub
'''''''''''''''''''''''''''''''''''''''''
' your stuff
MsgBox "doing button #1 things"
'''''''''''''''''''''''''''''''''''''''''
End Sub


Sub SecondButton()
IAmTheCount = 0
'''''''''''''''''''''''''''''''''''''''''
' your stuff
MsgBox "doing button #2 stuff"
'''''''''''''''''''''''''''''''''''''''''
End Sub


Once the first macro increments the count to three, it does not proceed.
The second macro clears the counter and allow the first macro to resume.
--
Gary''s Student - gsnu201002


"Arlen" wrote:

Hello Experts.

I have a Yahtzee game with 2 buttons/2 macros.

One button (Roll Dice) rolls the dice (Calculate) and the second button
(Next Player) clears all checkboxes on the sheet.

However, I'd like to know if there's a way to disable the first button after
it's been clicked 3 times, then re-enable it once the second button is
clicked and start the count over...

Please advise.

I thank you for your time.

  #4   Report Post  
Old May 12th 10, 04:33 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2007
Posts: 86
Default Count and Reset Button Clicks

Gary's Student,

Perfect. But now you got me thinking. How can I make that message box pop
up ONLY after you've exceeded your 3 rolls, with a message like "Quit
Cheating, You Sonuva*&%@!"

I'll keep shuffling code around, but if you see this, let me know.

Thanks again!

"Gary''s Student" wrote:

We can use a Global variable to communicate between the two macros:

Dim IAmTheCount As Integer

Sub FirstButton()
If IsEmpty(IAmTheCount) Then
IAmTheCount = 0
End If
IAmTheCount = IAmTheCount + 1
If IAmTheCount 3 Then Exit Sub
'''''''''''''''''''''''''''''''''''''''''
' your stuff
MsgBox "doing button #1 things"
'''''''''''''''''''''''''''''''''''''''''
End Sub


Sub SecondButton()
IAmTheCount = 0
'''''''''''''''''''''''''''''''''''''''''
' your stuff
MsgBox "doing button #2 stuff"
'''''''''''''''''''''''''''''''''''''''''
End Sub


Once the first macro increments the count to three, it does not proceed.
The second macro clears the counter and allow the first macro to resume.
--
Gary''s Student - gsnu201002


"Arlen" wrote:

Hello Experts.

I have a Yahtzee game with 2 buttons/2 macros.

One button (Roll Dice) rolls the dice (Calculate) and the second button
(Next Player) clears all checkboxes on the sheet.

However, I'd like to know if there's a way to disable the first button after
it's been clicked 3 times, then re-enable it once the second button is
clicked and start the count over...

Please advise.

I thank you for your time.



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
RESET BUTTON CandiC Excel Worksheet Functions 2 November 2nd 09 10:19 PM
Reset Button Raz Excel Worksheet Functions 3 November 26th 08 11:32 PM
Reset Button Raz Excel Worksheet Functions 4 November 26th 08 05:26 PM
Reset Button trilogy Excel Discussion (Misc queries) 0 July 27th 06 03:36 AM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Discussion (Misc queries) 2 August 1st 05 08:23 AM


All times are GMT +1. The time now is 10:41 PM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017