S
sross002
Hello,
Can someone please help?
I get a COMPILE ERROR on my MAC. I am running OSX
It says: my sub or function is not defined.
Here is my Code:
Sub Picture1_Click()
Dim chipcnt As Variant
Dim MyRange As Range
'Clear the chip distribution cells
Set MyRange = Worksheets("Calculator").Range("F3:F11")
MyRange.Clear
'Loop through each chip denomination
For i = 3 To 11
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'Determine the maximum number each player can have
chipcnt = Cells(i, 2).Value / Cells(14, 4).Value
'Round the results down
If Round(chipcnt, 0) > chipcnt Then
chipcnt = Round(chipcnt, 0) - 1
Else
chipcnt = Round(chipcnt, 0)
End If
'Grab the desired stack size and determine the current stack size
Cells(i, 6).Value = chipcnt
stack = stack + chipcnt * Cells(i, 3).Value
GoodStack = Cells(15, 4).Value
'Adjust the chip distribution to meet the desired stack size
If stack > GoodStack Then
j = i
Do While stack > GoodStack
Do While stack - GoodStack >= Cells(j, 3).Value
If Cells(j, 6).Value = 0 Then
Exit Do
End If
Cells(j, 6).Value = Cells(j, 6).Value - 1
stack = stack - Cells(j, 3).Value
Loop
j = j - 1
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Loop
Exit For
End If
Next
'Warn if the user does not have enough chips to reach stack size
If stack < GoodStack Then
MsgBox "You do not have enough chips to generate this stack size.",
vbCritical, "Stack too big!"
MyRange.Clear
Cells(15, 4).Activate
End If
End Sub
What are my errors?
Can someone please help?
I get a COMPILE ERROR on my MAC. I am running OSX
It says: my sub or function is not defined.
Here is my Code:
Sub Picture1_Click()
Dim chipcnt As Variant
Dim MyRange As Range
'Clear the chip distribution cells
Set MyRange = Worksheets("Calculator").Range("F3:F11")
MyRange.Clear
'Loop through each chip denomination
For i = 3 To 11
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'Determine the maximum number each player can have
chipcnt = Cells(i, 2).Value / Cells(14, 4).Value
'Round the results down
If Round(chipcnt, 0) > chipcnt Then
chipcnt = Round(chipcnt, 0) - 1
Else
chipcnt = Round(chipcnt, 0)
End If
'Grab the desired stack size and determine the current stack size
Cells(i, 6).Value = chipcnt
stack = stack + chipcnt * Cells(i, 3).Value
GoodStack = Cells(15, 4).Value
'Adjust the chip distribution to meet the desired stack size
If stack > GoodStack Then
j = i
Do While stack > GoodStack
Do While stack - GoodStack >= Cells(j, 3).Value
If Cells(j, 6).Value = 0 Then
Exit Do
End If
Cells(j, 6).Value = Cells(j, 6).Value - 1
stack = stack - Cells(j, 3).Value
Loop
j = j - 1
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Loop
Exit For
End If
Next
'Warn if the user does not have enough chips to reach stack size
If stack < GoodStack Then
MsgBox "You do not have enough chips to generate this stack size.",
vbCritical, "Stack too big!"
MyRange.Clear
Cells(15, 4).Activate
End If
End Sub
What are my errors?