Skip to content

Introduction to Visual Basic for Applications, or VBA, to add even more analytical power to Excel.

Notifications You must be signed in to change notification settings

benpeyton76/stock-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Stock Analysis

Overview:

In this challenge, we are using Visual Basic for Applications (VBA) to automate code so that Steve can research the stock market for his parents. They are interested in renewable energy and want to invest in companies that build green energy systems and components. Steve wants us to create code that, when run, will give him the total daily volume and annual return of the green energy companies. We will be refactoring code to loop through all given data and determining if refactoring makes the code more efficient.

Results:

In the original code, running code for 2017 took approximately 0.523 seconds.

VBA_Challenge_2017(1)png

For 2018, it took about 0.531 seconds to run.

VBA_Challenge_2018(1)

After refactoring and adding a total of three output arrays, the code ran more effeciently than the original code. When running the refactored code for 2017, it took approximately 0.082 seconds.

VBA_Challenge_2017

Running the refactored code for 2018 0.078 seconds.

VBA_Challenge_2018

Summary:

As shown by the images above, refactoring code can substantially increase runtime efficiency while being executed. Looping code saves time because writing individual code for every variable separately would be extremely time consuming. Refactoring code can also be easier to debug. One disadvantage of refactoring is that it can not improve underlying code building issues. This can be an issue when the programming language becomes dated. Another disadvantage to refactoring code is that it can potentially introduce bugs that take time to find and fix.

About

Introduction to Visual Basic for Applications, or VBA, to add even more analytical power to Excel.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published