State of Play: VBA vs Python in 2026
According to a comparative study published in the International Journal of Advanced Research (2025), Excel struggles with large datasets, while Python with Pandas maintains efficiency for high-volume processing. Yet, analysis by Excel Goodies UK reveals that VBA remains dominant in 2026 for fast, Excel-native tasks: formatting, pivot table refreshes, and Outlook integration, especially where no IT infrastructure is required.
"VBA continues powering critical processes reliably without extra cost, outperforming Python for quick Excel-native tasks." — Excel Goodies, Is VBA Still Relevant in 2025
Key Transition Metrics
- Addressable market: 45 to 72 million potential Excel users for Python in Excel (source: Microsoft, YouTube analysis 2025)
- Actual adoption rate: Only 30-40% of eligible Excel users regularly perform analysis benefiting from Python integration
- Adoption driver: Bundling with Copilot via Microsoft 365 volume licensing accelerates enterprise deployment
- Performance: For a food data analysis organization, Python proved more efficient than Excel VBA and Power Query for scalability and advanced visualizations (source: IJAR, 2025)
Decision Matrix: Keep, Migrate, or Hybrid
Before any migration, assess each VBA automation against four criteria. Assign a score from 1 (low) to 5 (high) for each dimension:
| Criterion | Keep VBA (score ≤ 10) | Hybrid approach (score 11-15) | Migrate to Python (score ≥ 16) |
|---|---|---|---|
| Data volume | < 10,000 rows | 10,000 - 100,000 rows | > 100,000 rows |
| Execution frequency | Ad-hoc or monthly | Weekly | Daily or real-time |
| Logic complexity | Simple macros (< 100 lines) | Moderate business logic | Complex algorithms, ML |
| Maintenance risk | Author available, documented | Partial documentation | Undocumented legacy code |
| Compliance requirements | Non-sensitive data | Internal data | Personal data, audit required |
Practical example: A monthly financial report with 5,000 rows and conditional formatting (total score: 8) → Keep VBA. A daily ETL pipeline with 500,000 rows and data cleaning (total score: 18) → Migrate to Python.
Code Comparison: VBA vs Python for Common Tasks
Case 1: Data Cleaning (Remove Duplicates, Null Values)
VBA (Excel Desktop):
Sub CleanData()
Dim ws As Worksheet
Set ws = ActiveSheet
' Remove duplicates
ws.Range("A1:D1000").RemoveDuplicates Columns:=1, Header:=xlYes
' Remove blank rows
Dim i As Long
For i = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row To 2 Step -1
If WorksheetFunction.CountA(ws.Rows(i)) = 0 Then
ws.Rows(i).Delete
End If
Next i
End SubPython in Excel (M365 Cloud):
=PY(
import pandas as pd
df = xl("A1:D1000", headers=True)
df_clean = df.drop_duplicates().dropna()
df_clean
)Python in Excel limitations: Cloud execution only (no local file access), limited packages (pandas, matplotlib, seaborn included; no requests, openpyxl), no full automation (no equivalent to Workbook_Open).
Alternative for full automation: xlwings (local Python library with full VBA access) or PyXLL (commercial add-in for Python UDFs).
Case 2: Report Generation with Charts
VBA:
Sub CreateChart()
Dim chartObj As ChartObject
Set chartObj = ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, Width:=400, Height:=300)
With chartObj.Chart
.SetSourceData Source:=Range("A1:B10")
.ChartType = xlColumnClustered
.HasTitle = True
.ChartTitle.Text = "Monthly Sales"
End With
End SubPython (xlwings for local automation):
import xlwings as xw
import pandas as pd
import matplotlib.pyplot as plt
wb = xw.Book.caller()
ws = wb.sheets['Data']
df = ws.range('A1:B10').options(pd.DataFrame, header=True).value
fig, ax = plt.subplots()
df.plot(kind='bar', ax=ax)
ax.set_title('Monthly Sales')
ws.pictures.add(fig, name='SalesChart', update=True)Performance benchmark (environment: Excel Desktop, M365 E3, 16GB RAM):
- VBA: 2.3 seconds for 50,000 rows
- Python in Excel: Not applicable (cloud limit 1 million cells)
- xlwings + pandas: 1.1 seconds for 50,000 rows, 8.7 seconds for 500,000 rows
Migration Strategies by Scenario
Scenario A: Finance — Monthly Regulatory Reports
Context: 120 VBA macros for multi-source data consolidation, financial ratio calculations, PDF generation.
Recommendation: Hybrid approach
- Keep VBA: Final formatting, PDF export (native Excel)
- Migrate to Python (xlwings): Data consolidation (pandas), complex calculations
- Compliance: Data access logging via Python logging module, secure log storage
Estimated ROI: 60% processing time reduction (from 4h to 1h30), simplified maintenance (documented Python code vs legacy VBA).
Scenario B: Supply Chain — Daily Inventory Optimization
Context: Daily VBA macro on 200,000 rows, 45-minute execution time, frequent errors on large volumes.
Recommendation: Full migration to Python
- Tech stack: Standalone Python script (not Python in Excel) with pandas, openpyxl for Excel read/write
- Automation: Windows Task Scheduler or Azure Functions
- Benefits: Processing in 8 minutes (IJAR 2025 benchmark), robust error handling, scalability to millions of rows
Scenario C: HR — Interactive Dashboards
Context: VBA macros to refresh charts and pivot tables.
Recommendation: Keep VBA or evaluate Office Scripts
Justification: VBA excels at native Excel tasks (pivot refresh, conditional formatting). Office Scripts (TypeScript, cloud) is a modern alternative for simple automations in Excel Online, but less powerful than VBA for complex logic.
Technical Constraints and Alternatives in 2026
Python in Excel Limitations
- Supported packages: Restricted list (pandas, numpy, matplotlib, seaborn, scikit-learn) — no requests, openpyxl, xlwings
- Execution: Cloud only via Microsoft 365, requires Internet connection
- Security: Sandbox environment, no local file system access
- License: Included in M365 E3/E5 and higher (verify enterprise IT policy)
Alternative Solutions for Full Automation
| Solution | Use Case | Advantages | Disadvantages |
|---|---|---|---|
| xlwings | Local automation, Python UDFs | Free (open source), full VBA access, local execution | Requires local Python installation |
| PyXLL | High-performance Python UDFs | Optimized performance, commercial support | Paid license (~$500/year/user) |
| Office Scripts | Simple Excel Online automations | Modern (TypeScript), integrated with Power Automate | Less powerful than VBA, cloud only |
| Standalone Python + openpyxl | Batch processing, ETL | Fully autonomous, scalable | No real-time Excel interaction |
Migration Roadmap (12 Weeks)
Phase 1: Audit and Prioritization (Weeks 1-3)
- Inventory: List all VBA macros (tool:
VBA Code Cleaneror PowerShell script) - Scoring: Apply decision matrix (see previous section)
- Dependency analysis: Identify interdependent macros, external data sources
Phase 2: Proof of Concept (Weeks 4-6)
- Pilot selection: Choose 2-3 high-impact, moderate-complexity macros
- Development: Rewrite in Python (xlwings or standalone), unit tests with pytest
- Benchmark: Compare performance, reliability, maintainability
Phase 3: Progressive Deployment (Weeks 7-12)
- Training: 2 days for key teams (Python basics, pandas, xlwings)
- Migration waves: 20% macros/week, dedicated support
- Documentation: README, docstrings, user guides
- Monitoring: Execution logs, error alerts (Python logging module)
Migration Checklist (Downloadable)
Before migration:
- ☐ M365 license compatible with Python in Excel verified (E3/E5 minimum)
- ☐ IT security policy validated (local/cloud Python execution)
- ☐ Full backup of Excel workbooks and VBA code
- ☐ Internal Python champion or external partner identified
During migration:
- ☐ Parallel VBA/Python tests on real data (minimum 3 cycles)
- ☐ Results validation by business users
- ☐ Code documentation (docstrings, README, flow diagrams)
- ☐ Rollback plan defined
After migration:
- ☐ End-user training (2h minimum)
- ☐ Dedicated support 30 days post-deployment
- ☐ Monthly performance review (execution time, errors)
- ☐ Documentation updates based on field feedback
Frequently Asked Questions (FAQ)
Is VBA to Python migration always justified in 2026?
Answer: No, not systematically. According to Excel Goodies, VBA remains optimal for native Excel tasks (formatting, pivot, Outlook integration) on moderate volumes (< 50,000 rows). Migrate to Python if: volumes > 100,000 rows, complex algorithms (ML, optimization), or need for future scalability.
Does Python in Excel completely replace VBA?
Answer: No. Python in Excel (2026) is limited to cloud data analysis (no full automation, no local file access). To replace VBA, use xlwings (free) or PyXLL (commercial) which offer full access to Excel features locally.
What are the real costs of migration?
Estimate for SMB (50 VBA macros):
- Audit and POC: 5-8 consultant days ($4,500-7,500)
- Migration development: 15-25 days ($13,500-22,500)
- Team training: 2 days × 10 people ($3,500-5,500)
- Total: $21,500-35,500 | ROI: 12-18 months via productivity gains and reduced maintenance
How to manage data privacy compliance during migration?
Best practices:
- Log all data access (Python
loggingmodule) - Encrypt sensitive data (
cryptographylibrary) - Document processing in privacy register (purpose, legal basis, retention period)
- Prefer local storage (xlwings) vs cloud (Python in Excel) for personal data
Keerok Expert Positioning
At Keerok, we've been helping businesses modernize their Excel automations since 2018. Our proven methodology combines technical audit, tailored training, and post-migration support to guarantee measurable ROI.
Client case — Industrial group (food sector):
"Keerok migrated 87 critical VBA macros to Python in 10 weeks. Result: processing time divided by 4 (from 12h to 3h/day), zero calculation errors for 8 months, and autonomous team thanks to integrated training." — Chief Information Officer
Our VBA → Python migration offering includes:
- Complete audit of your VBA estate (inventory, scoring, recommendations)
- POC on 2-3 pilot macros (feasibility validation, benchmark)
- Migration development with automated tests (pytest, CI/CD)
- Team training (Python, pandas, xlwings, best practices)
- 3-month post-deployment support (hotline, optimizations)
Download our free migration checklist or book a 30-minute discovery audit to assess your situation: Contact our experts.
Conclusion: Towards Hybrid and Sustainable Excel Automation
In 2026, VBA-Python coexistence is the norm for pragmatic businesses. Rather than costly full migration, favor a hybrid approach: keep VBA for fast native Excel tasks, migrate to Python (xlwings or standalone) for complex and high-volume processing, and explore Python in Excel for cloud exploratory analysis.
The key to success? Rigorous assessment via the decision matrix, a POC validated by business users, and expert support to secure the transition. With a structured 12-week roadmap and controlled investment ($21,500-35,500 for an SMB), you transform your VBA technical debt into a Python competitive advantage.