r/vba • • Jul 26 '25

Show & Tell Building a VBA AI Agent

1 Upvotes

Hi everyone!

Over the past few weeks I’ve been experimenting with AI-driven prompt design and agentic workflows to automate my VBA macro development—and I’ve cut my macro-creation time by about 90% by creating a rapid iterating workflow and an automated testing setup for my AI Agent.

I’m now building a simple Windows desktop app that:

• Generates VBA macros from plain-English prompts

• Applies best-practice code patterns and error handling

• Lets you iterate on prompts to refine your macro in seconds

I’d love to get feedback (and possibly some early testers) from VBA experts and anyone who automates Excel.

Would you be interested in trying a preview build? What features or integrations would make this tool indispensable for your workflow?Thanks in advance for your input!


r/vba • • May 01 '24

Discussion Death trap in vba/excel - need inspiration

2 Upvotes

Good Day,
As procurement administrator I've created a personal planning tool to follow up my outstanding orders and my ongoing shipments. Data was based on simple daily export generated from the shitty ERP we work with,

It was a very educative experience creating this. First took more than a year. Then we had a ransomware hack, and i created a new version in about four months, 99% of the work was done outside of work.

Anyway, I recently resigned because of many reasons, but one is not being appreciated for my knowledge of my products and my efficiency in my work.

They now ask me gently if i would 'give' my tool to them and give a small instruction.

What type of death trap could i add to mess with them?

Currently thinking about

  • somewhere adding an automatic mail to our ceo or hr, since there is an other automail function implemented in an other module.

  • start printing random stuff on different printers throughout the office


r/vba • • Mar 27 '23

Unsolved chatgpt for vba sucks

1 Upvotes

i tried to copy paste chatgpt code to search for and identify a sum of numbers in a data set that gives me a specified value. tried to run the code but it kept giving me error messages. anyone else have luck using chatgpt or is it just awful all around?


r/vba • • Feb 23 '23

Discussion ChatGPT still has issues

1 Upvotes

I have asked chatGPT to generate code to draw a moving starfield. It wrote code for 2 different controls and it does not take proper care of overflow errors, it will show plenty of such errors.

When you point out errors, it generates code again and forgets the previous instructions for the code. So it does not correct the code, it generates code to address the specific error, without taking account compatibility with the previous code it wrote.

So it means you will need to debug the code it wrote.

chatGPT seems good to discuss specific ways to do calculations, but it is not yet at a point where a programmer could be replaced.

An example of a request chatGPT can handle.

If the center of a circle is located in centerx coordinate and a point in the circle is located at x in the top left quadrant, what is the formula to calculate the equivalent point in the circle for the top right quadrant?

An example of a request it cannot handle. It will use trigonometric functions that adds lots of processing overhead. Also this is very inefficient if crcle size is small, because x and y coordinates will overlap constantly with coordinates previously calculated.

If we draw a point using pset like picStarfield.PSet (x, y), stars(i, 3) and we have a size that indicates how big the circle would be around a coordinate x,y, what would be the most efficient way to draw a circle using pset given that we have a size number?

chatGPT seems like it is very useful to establish that mental conversation we all need when coding, but it is not yet ready to replace a programmer.

It is not yet ready as a high level programming language that uses human instructions to generate code.

What do you think?


r/vba • • 27d ago

Solved Code Is Slow

0 Upvotes

This code works but it's slow. Am I doing something wrong?


Sub COMPILEWORKSHEETS()

On Error Resume Next: Application.DisplayAlerts = 0: Worksheets("THE_PILE").Delete: Application.DisplayAlerts = -1: On Error GoTo 0

Application.ScreenUpdating = -1: Worksheets.Add After:=Worksheets(Worksheets.Count): ActiveSheet.Name = "THE_PILE"

x = 1: i = 1: On Error GoTo 404: GoTo PENGUIN

FAX_MACHINE:
Worksheets(i).Cells(j, k).Copy: Worksheets("THE_PILE").Activate: Cells(x, k).Select: Selection.PasteSpecial -4163: Application.CutCopyMode = 0: DoEvents: Return

PINEAPPLE:
i = i + 1: Err.Raise 7313

MY_LAWYER:
Worksheets("THE_PILE").Activate: Range("A1").Select: MsgBox "done", 64, "Done": Exit Sub

CHEESE:
j = j + 1: GoTo POTATO

PENGUIN:
If i >= Worksheets.Count Then Err.Raise 7314
GoSub COUNT_SHEEP: j = 1: GoTo MAYONNAISE

MAKE_ROW_HAPPEN:
x = x + 1: Return

POTATO_CHIPS:
GoTo TAX_FRAUD

POTATO:
If j > a Then Err.Raise 7312
If i > 1 And j = 1 Then Err.Raise 7315
k = 1: GoTo POTATO_CHIPS

COUNT_SHEEP:
a = Worksheets(i).Cells(1048576, 1).End(-4162).Row: b = Worksheets(i).Cells(1, 16384).End(-4159).Column: Return

WAFFLE:
GoSub MAKE_ROW_HAPPEN: GoTo CHEESE

TAX_FRAUD:
If k > b Then GoTo WAFFLE
GoSub FAX_MACHINE: k = k + 1: Err.Raise 7311

MAYONNAISE:
GoTo POTATO

WRONG_TURN:
GoTo PENGUIN

404 If Err.Number = 7311 Then Resume POTATO_CHIPS
If Err.Number = 7312 Then Resume PINEAPPLE
If Err.Number = 7313 Then Resume WRONG_TURN
If Err.Number = 7314 Then Resume MY_LAWYER
If Err.Number = 7315 Then Resume CHEESE
MsgBox "A REAL ERROR HAS OCCURRED: " & Err.Number & " - " & Err.Description, 16, "UNEXPECTED COMPETENCE": Exit Sub

End Sub

r/vba • • Jul 20 '26

Unsolved Vbagx on wii is messing up certain colors

0 Upvotes

So ive just got vbagx on my wii and ive tried three games and each has problems with certain colors. The opening of Buu's fury is all neon green, Aria of Sorrow has the same problem but in game in the water areas the water is neon green and Pokemon Fire Red has that problem as well. Ive messed with filters and settings but have been unable to find the solution. Any help is appreciated.


r/vba • • Apr 15 '18

Learn Visual Basic for Application Concept

Thumbnail
youtu.be
0 Upvotes

r/vba • • Apr 24 '26

Unsolved What is the best AI to improve VBA code?

0 Upvotes

Hi everyone,

As I mentioned in previous posts about my VBA automation code that I used ChatGPT to make but I heard there are better options to make more sustainable codes for such tasks?


r/vba • • Jan 22 '19

Advertisement What is the Difference Between Visual Basic.Net and VBA?

Thumbnail
freelancinggig.com
0 Upvotes

r/vba • • Nov 05 '17

(CHALLENGE) VBA script to find a bunch of text strings within a column and go down each row until the end...

0 Upvotes

I need some real help getting this resolved.

https://redd.it/7azqlh


r/vba • • May 16 '22

Discussion Business report automation with Excel/VBA

0 Upvotes

I have been asked to create business reports from scratch with high level of automation in excel. What are some common VBA codes to automate business reports?


r/vba • • Jul 30 '18

Unsolved VBA object explained.Please subscribe to it for learning VBA basic to advanced.

Thumbnail
youtu.be
2 Upvotes

r/vba • • Mar 03 '25

Discussion Does VBA have any AI you can interact with VBA code to process data?

3 Upvotes

Excel has many libraries to interact with. Is there any way to analyze data using VBA with the help of an AI? Where can I learn to use it?


r/vba • • Mar 27 '25

Discussion Learning VBA through GPT

3 Upvotes

Hi everyone,

I have years of experience in using Excel. However, I don't have experience in VBA and will look forward to become skilled in this. I'm starting to take courses and read online while experimenting.

There many GPTs when I click "Explore GPTs" in ChatGPT that has "VBA". What are the differences between them? any suggestions?

Thanks!


r/vba • • Dec 20 '22

Solved Inherited an Excel sheet, need to make changes to the macro and have no idea what I'm doing

0 Upvotes

So I started a job in September. Coming from a Desktop Support background, one of the reasons they wanted me to join their team was because I was a "techy". Which is sorta true - I can fix Excel errors, Bloomberg etc. But I have zero coding experience beyond changing 1's and 0's in .ini files.

Context: My job is to generate test scripts for testers to test their recovery strategy in case of a business impacting event.

There are two Excel Files - The Generator and the Template.

Generator has the Macro. It has 3 tabs - Applications and Functions and Testers. We put in the Testers in the Testers tab. It looks up the Testers in the Functions, and then pulls a list of applications for that function and then opens the Template and populates that.

The template has 2 tabs - Recovery Script and Data Entry Tab. The Recovery Script has a basic layout and formula that needs to stay that way in order for us to upload it to our tool. The Data Entry Tab is our user friendly interface that we send to the users. The Recovery Script is usually hidden when we send it to users. Both tabs reference each other - So when the Generator populates the Template, it populates the Recovery Script tab. In the Data Entry Tab, it looks up what has been populated and just references that with a short simple formula.

I've been asked to recreate the Template file to make it a bit easier for the testers. However, any changes I make to it messes up the Macro. Either only some of the applications will populate, or none of them will populate. On top of that, if the applications populate, the formula's alongside them won't in some cases.

I can read the macro and VBA but I have no idea what to change. I've been at this for a month now and I only have two weeks left. I'm desperate and need guidance. I was only given this task because I was a "techy" and I thought how hard could it be? Answer: Very. The only changes I've made are the numapps variables.

Could I please ask someone to take a look at this code and let me know where I'm going wrong or what I should change?

EDIT:

Thank you /u/Outside_Cod667 for assisting! For some reason there was a line in the VBA that deleted duplicates. I guess it kept seeing the formula's as duplicates? Nonetheless, they resolved it with ease.

Thank you so much, you are my angel and have saved me!


r/vba • • Jun 04 '18

Don't be that guy (gen neutral), back up your macros!

0 Upvotes

This is a cross post from r/excel.

I intended to write a long post and then realized we are all too busy for my editorializing. So bottom line up front: If you use macros, and specifically a Personal.XLSB, find a way to back them up frequently! If any easy way doesn't exist or you are too lazy (like me) to do it manually then make 1, before you lose your precious macros.

I started writing macros last year and it has quickly become an obsession for work. Then 1 day last week my computer refused to boot up, a corrupted file. IT said they were unable (or unwilling) to recover any data (queue wailing and gnashing of teeth followed by heavy drinking). Thankfully I had shared a few of macros with folks on my team so not all was lost. But I needed a way to backup my macros, windows auto-backup wasn't an option and I wasn't going to do it manually.

To this end, I found and modified a Workbook macro that will automatically make a backup of my Personal.XLSB every time I save it:

Option Explicit

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

'use Before Save event as Before Close event will not be triggered by Personal

'location to backup Personal.XLSB to (network drive, etc.)

Const sBak As String = "(drive):\(filepath)\Personal.xlsb"

Application.DisplayAlerts = False

With Workbooks("Personal.xlsb")

.SaveCopyAs sBak & Format(Now(), "_yyyymmdd.bak")

.Save

End With

Application.DisplayAlerts = True

End Sub

If you use this, place it in ThisWorkbook in your Personal.XLSB and edit where you want the backup to save to. To restore the backup is quite easy: copy the .bak file into your XLSTART folder and rename the file replacing ".bak" with ".XLSB".

If my mistake can save even 1 person out there from the same fate than I will find solace in that knowledge.


r/vba • • Mar 30 '18

Excel VBA basics in few days

1 Upvotes

I ll have an interview this coming week where i ll have to say i know VBA on beginner level and give examples of how i have used it before.

Can anyone recommend me an online course which is the best based on a personal experience?

Appreciate your help


r/vba • • Jul 04 '24

Unsolved Disable Delete Key and display Msgbox

2 Upvotes

Hello! Hope all of you are doing great! This sounds like a beginner problem but it can’t seem to make it work.

I have been using an excel file to track patient data but somebody keeps deleting formulas. I have two functions here - first to disable right click so user can’t select data and delete it by using right click and the next is disable delete key and trigger a vba message about GDPR and source data integrity. I managed to sort disable right click but I can’t manage to get disable delete key work. I have used the vba code (attached) which forums have talked through.

Could any of you please help? I will be super grateful!


r/vba • • Jan 07 '26

Show & Tell VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web

Thumbnail
github.com
2 Upvotes

r/vba • • Sep 08 '22

Advertisement I've worked as a contract Excel macro writer - hit me up with your issues - $50 if it takes an hour or less, $30/hr after that

0 Upvotes

Also great with formulas if it's not macro-worthy.


r/vba • • Feb 14 '26

Solved I have to type everything? is there no keyword suggestion or completion?

3 Upvotes

Do I need to turn on a setting so that while I'm typing, the VBA Editor suggests and auto-completes keywords or variable names that have already been declared?

As it is, I'm having to type everything, repeatedly, such as ActiveSheet, MsgBox, MonthName etc.

This makes coding a repetitive and time-consuming process, compared to other programming languages. It almost makes me want to code VBA in VS Code (which can at least recognise and complete variable names), but this is not practical for running or debugging.

Thanks in advance.


r/vba • • Dec 31 '15

Are VBA Dictionaries an advanced skill?

0 Upvotes

How advanced are you in Excel VBA if you can do VBA Dictionaries?


r/vba • • Jan 12 '23

Discussion Come utilizzare le API QRADAR in Excel e VBA

0 Upvotes

Ciao sto provando ad interagire con QRADAR tramite il vba , avete qualche dritta ? Non ci riescodi solito lo faccio con python

Grazie


r/vba • • Feb 16 '19

Advertisement Regular expression using VBA

Thumbnail
youtu.be
0 Upvotes