View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Counter for user clicks

Here's one way, using the ThisWorkbook module. However, your description and
example do not seem to match ??

Dim ClickCount As Long
Private Const STARTCLICKCOUNT As Long = 21

Private Sub Workbook_Open()
ClickCount = STARTCLICKCOUNT
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
ClickCount = ClickCount - 1

Select Case ClickCount
Case 18, 15, 11, 8, 4, 2
Call Banker(Sh, Target)
Case Else
'Do Nothing ?
End Select

End Sub

Private Function Banker(WhichSheet As Worksheet, WhichCell As Range) As Long
MsgBox "Cell '" & WhichCell.Address & "' clicked on sheet '" &
WhichSheet.Name & "'"
End Function

NickHK

"Anthony" wrote in message
...
Can anybody provide some code for the following ..

Basically, the user is playing a game which consists of 21 rounds - after
the first 4 rounds they are forced to 'gamble' (and taken sheet4) after

the
next 3 and every 3 thereafter they are again forced to 'gamble' until

there
are just two rounds left. At this point the game ends and sheet6 is opened

So what I really need is a 'counter' which starts at 21 and each time the
user clciks a cell on sheet1 the counter reduces by 1. When this counter
reaches either 18,15,11,8,4,2 it firstly reduces the counter by 1 then

runs
the 'banker' macro.

I hope I have explained this well and hope even more it can be done!
many thanks in advance