90 likes | 261 Views
ME 142 Engineering Computation I. Variables, Equations & Functions Introduction to Basic Programming Language. Variables. A named element that stores information or data Variable examples: A=2.45 X=Y+Z I=I+1 B=“Hello Class”. Basic Math Operators. Same as used in Excel spreadsheets
E N D
ME 142Engineering Computation I Variables, Equations & Functions Introduction to Basic Programming Language
Variables • A named element that stores information or data • Variable examples: • A=2.45 • X=Y+Z • I=I+1 • B=“Hello Class”
Basic Math Operators • Same as used in Excel spreadsheets + add - subtract * multiply / divide ( ) parenthesis ^ exponent
Launching VBA • Enable Developer’s Tab • Once enabled, should remain enabled • Select Visual Basic from Developer’s Tab
Launching VBA • Right click on Project… • Select Insert/Module
Launching VBA Congratulations, you’re ready to begin programming!
Example VBA Function Function demo(a,b) ' (Input) 'An example program to add two numbers 'Add 2 numbers (Process) c = a + b 'Return results (Output) demo= c End Function