Introduction | Choosing Your First Programming Environment
When you decide to learn programming, one of the first questions you face is which programming language and development environment to choose.
There are many options, including Python, JavaScript, and C#, each with its own strengths.
So what should a beginner look for when choosing where to start?
I believe two things are particularly important: being able to understand how a program works and being able to see the results of running it immediately.
From this perspective, I still recommend Excel VBA to people who are already familiar with Excel.
This article focuses on writing VBA code yourself to create programs, taking a step beyond Excel’s macro recorder, which automates recorded operations.
What follows is my admittedly personal and opinionated explanation of why I recommend Excel VBA and what makes it so interesting.
1. Why Excel VBA Is a Good Starting Point for Beginners
1.1. Your Familiar Excel Environment Becomes Your Development Environment
One of the first obstacles beginners encounter is setting up a programming environment.
If you already use the desktop version of Excel, you can start programming in VBA without installing additional development software.
Simply enable the Developer tab in Excel and open the Visual Basic Editor. You now have an environment in which you can write and execute code.
VBA is available in the desktop versions of Excel for Windows and Mac. Creating and running VBA programs requires desktop Excel, as Excel for the web does not support VBA execution.
To save a workbook containing VBA code, use the macro-enabled workbook format (.xlsm).
The real convenience of Excel VBA, however, lies in being able to use familiar worksheets directly for program input and output.
1.2. You Can See How Your Program Works and What It Produces
This is the main reason I recommend Excel VBA.
Programming involves deciding what data to input, what operations to perform, and how to present the results.
Excel already provides worksheets where all these elements can be handled in a visible, familiar form.
For example, you can enter parameters into cells, perform calculations using VBA, and write the results into other cells. You can also display those results in tables and charts.
In other words, input, processing, output, and observation can all take place within a single environment.
You can then change the input parameters, run the program again, and immediately observe how the results change.
For beginners, this direct connection between the code they write and the results they see makes the learning process much easier to follow.
1.3. You Can Learn the Fundamental Structures of Programming
Excel VBA allows beginners to learn concepts shared by many other programming languages.
- Variables for storing data
- If…Then…Else statements for conditional processing
- For…Next and Do While…Loop statements for repeated operations
- Functions and procedures for organizing code
- Objects, properties, and methods for working with structured components
In Excel VBA, you work with objects such as Workbook, Worksheet, and Range, which provide a practical introduction to object-oriented programming concepts.
VBA also allows you to define classes. Its approach to inheritance and certain other object-oriented features has specific limitations, but working with objects and their methods provides useful experience for learning other programming languages.
Once you understand basic programming structures through VBA, you can apply that understanding when moving on to another language.
1.4. Learning Resources Are Widely Available
Excel VBA has been used for decades, so there are plenty of introductory books, tutorials, and online resources.
Excel’s macro recorder can also serve as a learning tool. By recording an operation and examining the generated VBA code, you can discover how familiar Excel actions are represented as programming instructions.
The Visual Basic Editor also includes debugging tools that let you execute a program one line at a time and inspect the values of variables.
These features make Excel VBA a practical environment for self-directed learning through writing, running, and examining your own code.
2. Simulating Random Processes with Excel VBA
Excel is widely known as spreadsheet software, but combining it with VBA greatly expands what you can do.
One capability I find particularly interesting is the ability to design and automate repeated calculations.
Suppose you want to investigate what happens under certain conditions.
For a single calculation, ordinary Excel formulas may be sufficient.
But what if you want to generate random values, vary the conditions, and repeat the same calculations thousands or tens of thousands of times?
With VBA, you can combine conditional statements and loops to perform large numbers of trials automatically.
Monte Carlo Simulation
For example, you could write a program that rolls a virtual die 10,000 times and records how frequently each number appears.
You could then increase the number of trials and observe how the relative frequency of each outcome changes.
Taking this idea further, you could assign probability distributions to multiple variables and repeatedly sample from those distributions to investigate the range and frequency of possible outcomes.
This is the basic idea behind Monte Carlo methods, which use repeated random sampling to obtain numerical estimates.
Markov Chains
Another interesting concept is the Markov chain.
A Markov chain is a probabilistic model in which the current state contains all the information needed to determine the probabilities of the next state.
For example, suppose we describe the weather using just two states: sunny and rainy.
We can assign different probabilities for tomorrow’s weather depending on whether today is sunny or rainy.
Using these transition probabilities, we can simulate how the weather changes from day to day.
By repeatedly simulating these transitions in VBA, we can investigate questions such as the proportion of time the system spends in each state over the long run.
Monte Carlo methods describe a computational approach based on repeated random sampling, while Markov chains describe probabilistic relationships between successive states.
The two can also be combined. We can use Monte Carlo simulation to generate many possible sequences of states governed by a Markov chain.
Related article (in Japanese): Discover the Power of Excel: Exploring Markov Chains and Monte Carlo Simulation with Random Numbers and VBA
By arranging parameters on a worksheet, running repeated calculations with VBA, and analyzing the results, you can turn Excel into a remarkably flexible simulation environment.
3. Using Programming to Understand the Structure of Decisions
The appeal of Excel VBA extends beyond automating calculations.
Consider a familiar financial decision: whether to buy a home or continue renting.
Many factors affect this decision, including property prices, mortgage interest rates, rent, maintenance costs, future resale values, and how long you expect to live in the property.
By representing these factors as variables and changing their values, you can compare the financial outcomes of buying and renting under different conditions.
You can also assign probability distributions to uncertain factors, such as future property prices and interest rates, and simulate a range of possible scenarios.
This allows you to examine not only average outcomes but also their variability and the probability of particular results.
Now consider another possibility: what if you could make your decision as new information becomes available?
The Value of Being Able to Wait
Suppose you have two options: buy a home now or continue renting for a while and decide whether to buy later.
If property prices fall, you might decide to buy. If prices rise sharply, you might choose to continue renting.
This flexibility allows you to make decisions after observing how future conditions develop.
Waiting also has costs. You continue paying rent, and rising property prices may make a future purchase more expensive.
To analyze this situation, you can construct a model incorporating changes in property prices and interest rates, the actions available at different points in time, the costs and benefits of those actions, and the time value of money.
You can then compare a strategy of purchasing immediately with one that allows you to decide whether and when to purchase as future conditions unfold.
This leads to the concept of real options analysis: evaluating the economic value of retaining the flexibility to make decisions in response to future developments.
Excel VBA can be used to construct and analyze models of this kind.
Separating What You Can Decide from What Remains Uncertain
Building such a model requires you to identify the elements that make up the decision.
What actions are under your control?
Which conditions are uncertain and will develop independently of your choices?
And by what criteria should you evaluate the outcomes?
In the housing example, you can choose whether to buy now or wait. Future property prices and market interest rates, however, are uncertain.
To compare the financial consequences, you also need appropriate measures of costs, asset values, and the timing of cash flows.
Available choices, uncertain conditions, and criteria for evaluating outcomes: organizing these three elements reveals the underlying structure of a decision.
I believe this points to another important benefit of learning programming.
To turn an idea into a program, you must break it down into explicit conditions and procedures.
Which elements should be represented as variables? Under what conditions should the program take different paths? What results should it calculate and evaluate?
Answering these questions one by one transforms an initially vague problem into something that can be examined systematically.
Once the program runs, you can observe what follows from the assumptions you have made.
If the results differ from your expectations, you can examine the code, reconsider the assumptions, and run the model again.
The reliability of the analysis depends on the validity of the model, the assumptions it incorporates, and the correctness of the program. Testing the model and comparing results under different conditions are therefore essential parts of the process.
Of course, real-life decisions also involve values, emotions, and beliefs that may be difficult to express numerically.
Even so, understanding the available options and how their outcomes depend on different conditions can help improve the quality of your decisions.
For me, programming is also a tool for supporting this process of thought.
4. Why I Still Recommend Excel VBA in 2026
The environments available for learning programming have evolved considerably.
Python, for example, is widely used in numerical computing, data analysis, machine learning, and web application development.
With Google Colab, you can write and execute Python code directly in a web browser, making it possible to begin learning without a complicated setup process.
Excel itself has also gained new programming and automation capabilities.
Office Scripts is a TypeScript-based system for automating Excel tasks. It is available in supported Excel environments and is particularly useful for cloud-based workflows involving Power Automate.
Python in Excel allows users of eligible Microsoft 365 environments to perform data analysis and visualization using Python. Python calculations run in Microsoft’s cloud environment and require an internet connection.
The availability and capabilities of these technologies depend on the version of Excel and the subscription or license involved.
Today, getting started with programming is much easier than it used to be.
So why do I still recommend Excel VBA as a first programming environment?
Because it allows you to use the data and operations you already know from Excel as the immediate subjects of your programming.
Cells and worksheets are familiar to regular Excel users.
By adding variables, conditional statements, and loops, you can begin creating programs based on questions that genuinely interest you.
Generative AI now provides another powerful resource.
You can ask AI to explain syntax, identify possible causes of errors, or translate an idea for a procedure into working code.
Understanding fundamental programming structures makes these tools even more useful.
You can read the code generated by AI, follow how variables and procedures interact, and evaluate whether the results match your intentions.
As generating code becomes easier, the ability to define what a program should do and evaluate what it produces becomes increasingly important.
Excel VBA offers a familiar environment in which to develop those abilities.
5. The Limitations of Excel VBA
Excel VBA has many advantages, but its suitability depends on the intended application.
For large datasets or computationally demanding numerical tasks, execution speed, available memory, and Excel’s worksheet limitations can become significant constraints.
Even in repeated calculations, frequent reading from and writing to individual worksheet cells can slow execution. Techniques such as using arrays can help improve efficiency.
For storing, searching, and updating large amounts of data, a dedicated database management system is generally more appropriate.
Similarly, web services, large business systems, and software developed and maintained by teams often benefit from programming languages and development environments designed for those purposes.
Excel VBA is particularly effective for automating Excel-based tasks and supporting personal calculations and analysis.
Security is another consideration.
VBA can interact with files and other resources on a computer, so macros obtained from external sources should be examined carefully, including their origin and behavior.
Microsoft has also introduced security measures that block macros in files obtained from the internet by default in applicable Office environments.
Understanding these characteristics helps you choose appropriate applications for Excel VBA and use it effectively.
Conclusion | Learning Programming, Then Learning to Think with Programming
For people who see the world in terms of probabilities and want to consider multiple possibilities before making decisions, Excel VBA remains a fascinating tool.
It allows you to construct models of familiar problems, define assumptions, repeat calculations, and observe the results.
In the process of learning programming, you are also required to express your own ideas in terms of variables, conditions, and procedures.
I believe one of the most rewarding aspects of programming lies here.
At first, you use Excel to understand programming.
But once you learn how to write and execute programs, you begin using programming to understand the problems that interest you.
You can make a computer execute the logic you have developed, then use the results to deepen your own understanding.
An idea that once existed only in your mind becomes a program. The program runs, and its results appear before you.
Sometimes the results confirm your expectations. At other times, they reveal something you had never anticipated.
Each outcome can lead to new questions and discoveries.
Excel VBA provides an environment in which you can experience this process directly through familiar worksheets.
If you are thinking about learning programming and already use the desktop version of Excel, I encourage you to try writing a small VBA program.
The logic you have created begins to run on its own.
And from there, a fascinating world of programming begins to open up.
Want to know more about the author and the thinking behind this site?
→ About Rikutsu-Kone-Taro