logo Electronic Design with Excel (VBA)

 Discover BASIC for circuit design and analysis!

 
VBA Intro, Examples | VBA Basics | Excel Calc Series | eCircuit Home

 

Learn from these VBA examples,
then modify the functions for your own designs.

Welcome to Electronic Design with Excel's VBA (Visual Basic with Applications). The two biggest tools I've typically used for electronic design are SPICE and Excel. Although far from perfect, Excel appears to be widely used today. But the real kicker is the BASIC programming in the form of VBA that's built into Excel. This is great news for us who need a powerful tool to run a few equations or explore a topic.

WHAT YOU CAN DO

  • Create custom VBA functions and algorithms.
  • Increase your understanding of electronic circuit design and analysis.
  • Explore topics such as basic circuits, waveform generators, ADCs, op amps, the Fourier Series and filters.

pic

 

NOTE! Windows may block a macro-enabled file (*.xlsm) from running - Good Precaution! To unblock, right-click on file, select Properties - Security and then check UNBLOCK.

TOPICS

Introduction to VBA calling a simple function.
A simple function (resistor divider) shows how variations of each resistor influences the output errors.
Generate a sine wave varying the frequency, amplitude, phase and offset.
Generate a triangle wave using IF, THEN, ELSE statements and some simple calculations.
Find the gain for the basic op amp amplifiers. Then find how gain effects bandwidth.
Learn ADC concepts such as LSBs, resolution and speed using for FOR loops and IF, THEN statements.
Create waveforms with Fourier Series. Generate a square wave and a sawtooth from a sum of sine waves.

 

WHY EXCEL/VBA?

SPICE and Excel / VBA both have a great capability - you can easily tinker, play and experiment with circuits and ideas. Is Excel a perfect tool? If you're like me, you wince at many of its clunky features. BUT, here are its accolades:
1) You can play with some ideas quickly,
2) you can send the file to someone else who probably has Excel too.
3) you get access to BASIC programming (VBA) which opens up a bigger world of circuits and algorithms to explore.

Finally, beware! Excel, like SPICE, can become addictive when exploring a topic.

pic

 

ABOUT THE VBA CODE

Let me say right here - I am not a programmer! You will not find elegant or efficient VBA code in these friendly confines. And for the purposes of this website, my lack of VBA prowess is an advantage. The focus will be on basic circuits and other EE concepts made simple. Hopefully, we can dive into some cool EE topics without stubbing our toe on esoteric code. However, if you have a passion for programming, then you might enjoy taking some functions to another level.

 

©  2017-2024 eCircuit Center