Loop goes into infinity

The task is to find the withdrawal amount necessary that when taken from the bank balance and when fees are applied the total fees + the withdrawal amount should equal to the bank balance so that there's nothing left. That withdrawal amount should then be displayed.

The thing is I've tried structuring the loop several ways but it still results in an infinite loop without producing the correct results.

[code]

Public conversionCost As Double = 0.035
Public atmFee As Double = 3.15

'Calculates the maximum amount you can withdraw from current balance
Public Sub FullDraw(ByVal flFee As Double, actBal As Double, excRate As Double)

the above would not help from preventing an endless loop since you do some calculations without any checks which in my opinion never would/could match:

withdrawalAmt = actBal - atmFee

here you take actBal from arguments and atmFee from unknown
withdrawalAmt is a difference which obviously is assumed to be positive or at least >= 1
if the assumption is wrong the loop would subtract 1 from withdrawalAmt and the loop is endless because finalAmt has different sign to actBal for any case.

Dim finalAmt As Double
Do Until finalAmt = actBal
withdrawalAmt -= 1

finalAmt is not initialized; hence the loop condition never is true initially and you subtract 1 from withdrawalAmt
it looks as if you would assume that withdrawalAmt, actBal and finalAmt are integer.

Dim conversionFee As Double = conversionCost * withdrawalAmt

conversionCost is another unknown variable and for any reason you multiply with a difference (which will be decreased by 1).
so it looks as if conversionCost is a percentage number.

if we take actBal = 100 and atmFee = 20 and conversionCost = 0.1 (what is 10%)

you see, even if you choose input variables which give a final amount that is greater than the balance amount, there is no real chance that amtBal ever matches finalAmt. so your code has two fatal mistakes. first, you have to correct the until condition which need to break from the loop if finalAmt is less than actBal. second, you need to find an algorithm which computes values for finalAmt that would approximate to actBal or - better - wouldn't use a loop for to computing the withdrawal amount. i don't see any reason why you need to decrease the withdrawal amount in a loop. this hardly will converge even if you would use cents to decrease. perhaps you post a real sample for your amounts and how you want to compute the values. that might us help to understand the problem.