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.
0
Utf
5/12/2010 12:11:01 AM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
747 Views

Similar Articles

[PageSpeed] 52

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.
0
Utf
5/12/2010 12:30:01 AM
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.
0
Utf
5/12/2010 3:23:01 AM
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.
0
Utf
5/12/2010 3:33:01 AM
Reply:

Similar Artilces:

Pivot table and counting.
I have a pivot table that gives me the number of rides done by a van. I can have the pivot table return the number of rides, but what I need is the number vans that participated for a certain day. Example, it is possible to have 27 trips done by 18 vans, how can I count the number of vans and not addup the van number? Any help appreciated. Thank you, Joe Hi Joe We need a bit more information on how your source data table is set up. What information do you have in each column? -- Regards Roger Govier sacredarms <sacredarms@discussions.microsoft.com> wrote: > I have a pi...

Cycle Counting
Hello, I am looking for ideas on how to cycle count serial number tracked items without increasing workload. Our serialized items are barcoded but the problem is the are situated on the pallet incorrectly and the pallet is placed on a third level of a racking system. If we could just cycle count based on item count and not include the serial number it would make it easy. Is this possible in Great Plains. We are running Great Plains 8.0. Any suggestions are greatly aprreciated. Thank You, Brian Morris Database Administrator ...

Lookup table with click-and-select?
Can someone point me in the right direction? I have several thermos bottles of various sizes that I use for tea. I have several varieties of tea that require different brewing parameters. I'd like to create a worksheet that will generate "brew slips" -- little slips of paper that show how much tea to use for each thermos. The left side of the sheet will be the brew sheet. It will have columns for ounces, cups, milliliters, grams of tea, etc. Something like this: Thermos Cups Oz mL g/pot A 2.0 16 473 ?? B 3.0 24 710 ?? C...

Count
Hi, I would like to know how which formula I should use to count some codes & to ignore the duplicated codes, for example in column A: Code 1234 4321 4321 1234 1234 3214 Now, I want Excel to count & the result is 3 which are: 1234-4321-3214 Yes I can use PivotTable, but I would like to use a formula because I have to deal with this every day. I appreciate your support. -- MFS22 COUNTIF will do it. =COUNTIF(Rng,Rng), where the criterion is the same as the range: e.g =COUNTIF(A3:A8,A3:A8) HTH Peter "MFS" wrote: > Hi, > I wo...

How do I count the # of times a value reoccurs and plot it over ti
I wish to plot a number of errors made by each users and compare it over time. I have a column of user ID's and a column of dates. I want the chart to count the number of times each user ID appears and plot against it's corresponding date. However, each time I try to do this, the chart appears wrong. Any ideas? In article <9595B2A1-8282-4AB3-8511-A6776E108164@microsoft.com>, Stephen@discussions.microsoft.com says... > I wish to plot a number of errors made by each users and compare it over > time. I have a column of user ID's and a column of dates. I want t...

Line count
I am working with a program called Dictaphone. We use Word 2007 in this program. The line count on Dictaphone and the line count in Word 2007 are different even though the Dictaphone text is retrieved from Word 2007. Why would they be different? What is the difference between virutal line count and physical line count? ...

count number of characters in rich edit control
How can i count number of characters in rich edit control 2 If u mean controls of type Rich TextBox control, try RichControl1 RC1; CString Mes=RC.GetText(); int n=Mes.GetLength(); "Rahul" <Rahul@discussions.microsoft.com> wrote in message news:7743023C-EA83-4ACA-AB67-F1AE7279F1EB@microsoft.com... > How can i count number of characters in rich edit control 2 EM_GETTEXTLENGTHEX, WM_GETTEXTLENGTH, WM_GETTEXT, EM_STREAM* "Rahul" <Rahul@discussions.microsoft.com> wrote in message news:7743023C-EA83-4ACA-AB67-F1AE7279F1EB@microsoft.com... > How can i co...

Functional buttons F3,F4,F5
Hi all, Uh i have e huge problem how can i do this! I need to make functional buttons to do some operations like save ,delete,or print...Press functional button F3 or click on form button Print .... I have buttons alredy and i have code on events on all this buttons. I know the way with main modules too put all this code in modules and then to do if is loaded some form do some event. But it is to complicate and i dont have time to do and test all that. Does somene know how can i do on some easy way . -- Message posted via http://www.accessmonster.com How about attaching them to a macro ...

double-click in between two rows or two columns
How to avoid cursor jumping around to different positions when I double-click in between two rows or two column ? Thanks Hi This is a feature of Excel! When you double click the border of the selected cell, the cursor will go to the edge of the contiguous data on the sheet. It's very useful for jumping to the start/end of data. I don't know of a way to disable it. -- Andy. "Ben" <anonymous@discussions.microsoft.com> wrote in message news:bf5d01c4382c$a19b1bf0$a601280a@phx.gbl... > How to avoid cursor jumping around to different positions > when I double-c...

Counting sales
I have two different datasets. Each with a common identifier. I need a formula that will reference the identifiers in both datasets and count the number of sales a particular agent made. Example. look up this identifier in the other dataset and then give me the value that is 2 columns over from the identifier in the second dataset. See if this helps: http://contextures.com/xlFunctions02.html -- Biff Microsoft Excel MVP "Dave" <Dave@discussions.microsoft.com> wrote in message news:E7245B37-033F-400E-9CEE-9822BE7CB0F5@microsoft.com... >I have two...

OL2002-Missing POP3 Accounts from Accounts button
Using OL2002. I have 5 POP3 email accounts and they do not show up under the Accounts button when I create a new email. Also, when I click the move up/move down buttons in the account setup screen, they randomly move and/or do not move when I click the buttons. I've found that if I click the move down button and then click an email account and repeat the process, I can get one or two of the email accounts to appear in the Accounts button drop down list, but am unable to make all of the accounts show up. Thanks in advance for the help. Scott ...

COUNT ? need formula
Hi, I want to track the results of my teams sales performance. I record if it is a sale, no sale, cancelled etc in column M. I thought I'd be able to use the COUNT function/formula to be able to search for all the SALES in column M and place the result in a cell ( column O )but I can't work it out. Any ideas? Damian Hi! Try this: =COUNTIF(M1:M100,"sale") Biff "Diamond Jones" <kwanzaNOSPAM@optusnet.com.au> wrote in message news:43a0e897$0$17704$afc38c87@news.optusnet.com.au... > Hi, > > I want to track the results of my teams sales perf...

Counting Cells with Conditional Formatting
Is there a way to look at a row of data that is either highlighted yellow or red and to count only the data that is highlighted yellow and give me that number? None of my data is numerical....just one letter data, i.e.: "S" or "U" I just want to count how many of the cells are highlighted yellow in a specific row, if that makes more sense. Here's a UDF (Put in a Standard module) and use it in cell A1, like =CountByColor(A8:H8,6) << where 6 (at present) = Yellow = change to =CountByColor(A8:H8,3) to get the reds HTH Function CountByColor(InRa...

Counting a count
How do I count a count?? This is what im trying to do: I have a database with a table named tblMain and has incorporated everything within that table but contains info from about 8 other tables. I have not doesigned this database and it appears to have a very poor structure...anyway There are three fields involved in this process...'Request' (either 'dispensation', 'waiver' or 'dispensation and waiver'), 'Department' (which consists of 7 other drop down menu options) and 'RequestStatus' which contains the status of each request by another...

Why does one have to click on the cmd button twice
PPT 2003 on Vista .. I have two CMD buttons that I click on one to display new numbers and the second to show the correct answer. I have to click on the second buttoon twice. I don't why becasue on slides from previous files it takes one click to display the data. I tried to match the properties thinking it is a focus issue, but all the properties seem to be the same. I can post the code if it is important. Thanks ... Phil Yes, the code you are using will be helpful. Also, check to see if there is an entrance animation added to the shape you show for the correct ans...

Count Function
I am creating a report for the number of pupils being collected at a certain collection time e.g. 14:00hr and 15:00hrs using the formula =Count([Child Last Name]) in the collection time footer However when i try to count the overall number of pupils in the footer using the same formula, 'Error' appears on screen? Thanks There are potentially a dozen footer sections in a report. Which one is giving you a problem? What is the name of the control? What is the exact formula? -- Duane Hookom Microsoft Access MVP "ELo" wrote: > I am creating a r...

Can't reset check box in menubar
Hello happy programmers, I have a menubar that has several items. I have several menu items that call forms. I have notice that once I have click a menu item a check mark appears next to the menu item. The form opens and then once done working there I close the form. If I tried to reopen the form using the same menu item, it is unable and with a check mark. I have also noticed that there is one menu item that doesn't have this strange defect. Once I click on it, it won't have a check mark it it is still enabled. Any ideas? Thank you in advance, V. -- Desktop Solutions for Small C...

Count Problem
Hi I have 20 cells in a single column in a sheet called "Audits" All the cells have a formula in them. The formula is a simple one that reads whatever I put into a cell on a different worksheet called "Names" ie: =Names!A1 = Names!A2 etc etc I would like to have a formula that counts up all the results I get in the sheet called "Audits" At the moment if I enter (let say) 15 names in the "Names" sheet the result is that I see the same 15 names in the "Audits" sheet, however the COUNTA formula returns a total of 20. SO obviously...

unique or distinct count from xml
How to get a unique count from a xml <Orders> <Order ID="1111" Amount="200"></Order> <Order ID= "2222" Amount="10"></Order> <Order ID="3333" Amount="5"></Order> <Order ID="1111" Amount="20"></Order> </Orders> The result should be 3 unique count and the 4 Order Id counts. How can i get using XPathNodeIterator using Compile,Execute with a XPathNavigator thanks you bhu The XPath expression for that is count(Orders/Order[not(@ID=preceding-sibling::Or...

Personal Folders-Properties-Advanced Button Missing
This button is missing on my Outlook 2000 Personal Folder (Folder List, right-click Personal Folder, select Properties). Would appreciate ideas for getting it back. It's not just on one user. I tried starting up Outlook in Admin for the first time. It made a brand new Personal Folder but this has no Advanced button either. Even uninstalling and reinstalling Office 2000 doesn't solve it. And no clues from Google searches. (Office 2000 Small Business in IMO mode running on fully-patched XP). -- David Tong [Please replace 'invalid' with 'com' to reply]. ...

Replace Count
I am using this routine to replace characters in a large text string. I would like to know how many replacements have been made. This is a generalized routine for experimenting. If I set lReplCount = 1, I can get a count but it takes over one minute to run. If I set lReplCount = -1, it takes about 20 mSec but I get no count (except 1). Is there any way to get speed and the replace count? I would be happy with a few seconds and an accurate count. Do If InStr(1, sText, vbCr & vbCr) > 0 Then lChangeCount = lChangeCount + 1 ...

Saving a Filter as a Query in VB Via a button, Can it be done?
Saving a Filter as a Query in VB Via a button, Can it be done? P.S. I use 07' More info can be found here about my question. http://www.access-programmers.co.uk/forums/showthread.php?t=145785 "JBurlison" wrote: > Saving a Filter as a Query in VB Via a button, Can it be done? P.S. I use 07' ...

Smart List record count in 10.0 SP2
Hello, I'm wondering if anyone else has seen a situation in the standard smart list for Purchase Line Items returns a different line count in the window than on the bottom of the window in the status bar. For instance, a client requested a search using the view "Today's Expected Receipts", so the window shows 4 rows, but the status bar at the bottom shows 8. The search criteria look to be the same as in my local view. Trying it in my local view, I get the same results for other views under this object, for instance the window shows 13 rows, but the status bar shows ...

Counting text cells #3
I have a range of cells A25:A256 that contain text entries of various types (doesn't matter). How do I get it in cell A258 to give me a total of cells that have text in them within that range 25:256 Thanks, Gurus Jessica =SUMPRODUCT(--(ISTEXT(A25:A256))) -- Regards, Peo Sjoblom "Jessica Walton" <jessica.w@zimshipping.com> wrote in message news:1E804A58-662A-47BA-B264-9EEE8A20994F@microsoft.com... > I have a range of cells A25:A256 that contain text entries of various types (doesn't matter). How do I get it in cell A258 to give me a total of cells that have ...

Can't send to Mail recipient when right click on file
get error message The MAPI Spooler could not be started. Close and then restart all mail-enabled applications. MAPI 1.0 [000004C7] ...