# VB6 Question

#### Charlie

##### Board Regular
Im looking to make a prog that will find out how much money I had in my pocket when I left the pub and went to the casino.
I paid = £1.00 to get in
I lost half my money there and paid £1.00 to get out.
I then went to a second casino and did the same thing
Paid £1 entry lost half my money,paid £1.00 to get out.
Not learning my lesson I went to a third casino and did it again
paid £1.00 to get in
lost half my remaining cash
and paid another £1.00 to get out.
I was then broke.
I want to find out how much money I started with, I think I gotta use a Do Loop for this but im stuck finding how much I spent.
This message was edited by Charlie on 2002-10-25 07:34

### Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
L

#### Legacy 98055

##### Guest
Hi Charlie.
There is probably an equation to solve this but I do not know how. This procedure works:
<pre>
Dim Broke As Currency, StartingCash As Currency, Visits
StartingCash = 6
Do
StartingCash = StartingCash + 0.01
Broke = StartingCash
For Visits = 1 To 3
Broke = Broke - 1
Broke = Broke - (Broke / 2)
Broke = Broke - 1
Next
Loop While Broke <> 0
End Sub
</pre>
Started with 21

Spent 1 = 20
Spend 1/2 = 10
Spend 1 = 9

Spent 1 = 8
Spend 1/2 = 4
Spend 1 = 3

Spent 1 = 2
Spend 1/2 = 1
Spend 1 = 0

Tom

#### Charlie

##### Board Regular
Hiya Tom, I came up with this answer with a lot of help I might add.
Loops are very new to me.

Option Explicit

Private Sub cmdQUIT_Click()
'Terminate Application
End
End Sub

Private Sub cmdStart_Click()
Dim intMyMoney As Integer
Dim intLoop As Integer
Dim intStops As Integer

intStops = 3
intMyMoney = 0
For intLoop = 1 To intStops
intMyMoney = (intMyMoney + 1) * 2 + 1
Next
picMessage.Print "I spent this amount "; "£"; intMyMoney

End Sub

you can tell me if it looks wrong my feelings wont be hurt.
Charlie

"

L

#### Legacy 98055

##### Guest
Your solution is better than mine.
Tom

#### Charlie

##### Board Regular
I did it but I still really dont understand how it found my amount spent.

Charlie

Replies
3
Views
240
Replies
1
Views
212
Replies
2
Views
552
Replies
3
Views
572
Replies
7
Views
413

1,181,105
Messages
5,928,098
Members
436,588
Latest member
mummabare

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back