ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel 2000 (https://www.excelbanter.com/excel-programming/277611-excel-2000-a.html)

Al[_9_]

excel 2000
 
Can Excel be used to write a program that evaluates a list
of variables and controls the order of computations by
utilizing "IF ___, THEN ___, ELSE ___" and "GO TO ___"
statements. If so, how?

Peter Atherton

excel 2000
 
Al

Here's one way

Sub TestCalc()
Dim data1 As Range, data2 As Range
Dim TestVar
Dim result As Double

TestVar = Range("B1")
Set data1 = Range("A4:A7")
Set data2 = Range("B4:B7")

If TestVar 50 Then
result = Application.WorksheetFunction.Sum(data1)
Else: result = Application.WorksheetFunction.Sum(data2)
End If

Range("B9").Value = result
End Sub

Regards
Peter
-----Original Message-----
Can Excel be used to write a program that evaluates a

list
of variables and controls the order of computations by
utilizing "IF ___, THEN ___, ELSE ___" and "GO TO ___"
statements. If so, how?
.



All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com