O
Office_Novice
Greetings, I have a function that adds two ranges then subtracts Range B from
Range A giving me "N" I would like to know how to modify the following to be
able to pass N back into a sub procedure on a userform.
Function GetBalances()
Dim x As Long, y As Long, N As Long
Dim ARange As Range, BRange As Range
Set ARange = Range("A:A")
Set BRange = Range("B:B")
x = WorksheetFunction.Sum(ARange)
y = WorksheetFunction.Sum(BRange)
N = x - y
Debug.Print N
End Function
Range A giving me "N" I would like to know how to modify the following to be
able to pass N back into a sub procedure on a userform.
Function GetBalances()
Dim x As Long, y As Long, N As Long
Dim ARange As Range, BRange As Range
Set ARange = Range("A:A")
Set BRange = Range("B:B")
x = WorksheetFunction.Sum(ARange)
y = WorksheetFunction.Sum(BRange)
N = x - y
Debug.Print N
End Function