Business Professionals
Techno-Business Professionals
Power BI | Power Query | Advanced DAX | SQL - Query &
Programming
Microsoft Fabric | Power BI | Power Query | Advanced DAX |
SQL - Query & Programming
Microsoft Power Apps | Microsoft Power Automate
Power BI | Adv. DAX | SQL (Query & Programming) |
VBA | Python | Web Scrapping | API Integration
Power BI | Power Apps | Power Automate |
SQL (Query & Programming)
Power BI | Adv. DAX | Power Apps | Power Automate |
SQL (Query & Programming) | VBA | Python | Web Scrapping | API Integration
Power Apps | Power Automate | SQL | VBA | Python |
Web Scraping | RPA | API Integration
Technology Professionals
Power BI | DAX | SQL | ETL with SSIS | SSAS | VBA | Python
Power BI | SQL | Azure Data Lake | Synapse Analytics |
Data Factory | Databricks | Power Apps | Power Automate |
Azure Analysis Services
Microsoft Fabric | Power BI | SQL | Lakehouse |
Data Factory (Pipelines) | Dataflows Gen2 | KQL | Delta Tables | Power Apps | Power Automate
Power BI | Power Apps | Power Automate | SQL | VBA | Python | API Integration
VBA (Visual Basic for Applications) may be decades old, but in 2025 it’s still one of the most effective ways to automate tasks inside Excel.
The beauty of VBA is that you don’t need to build massive projects — often, a few simple snippets of code can save hours every week.
Here are 20 ready-to-use VBA snippets you’ll find yourself reusing forever — from looping through data to cleaning, formatting, and exporting.
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
MsgBox ws.Name
Next ws
Dim cell As Range
For Each cell In Range("A1:A100")
cell.Value = UCase(cell.Value)
Next cell
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Range("B1").Value = Range("A1").Value
Sheets("Sheet2").Range("A:A").Value = Sheets("Sheet1").Range("A:A").Value
Sheets("Sheet2").Range("A1").Value = Sheets("Sheet1").UsedRange.Value
For Each cell In Selection
cell.Value = Trim(cell.Value)
Next cell
For Each cell In Selection
cell.Value = Application.WorksheetFunction.Proper(cell.Value)
Next cell
Selection.RemoveDuplicates Columns:=1, Header:=xlYes
Cells.EntireColumn.AutoFit
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count). _
SetFirstPriority
Selection.FormatConditions(1).DupeUnique = xlDuplicate
Selection.FormatConditions(1).Interior.Color = vbYellow
Range("A1:D10").Borders.LineStyle = xlContinuous
For i = 1 To 100
If i Mod 2 = 0 Then Rows(i).Interior.Color = RGB(230, 230, 230)
Next i
Dim pt As PivotTable, ws As Worksheet
For Each ws In Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt
Next ws
Charts.Add
ActiveChart.SetSourceData Source:=Range("A1:B10")
ActiveChart.ChartType = xlColumnClustered
ThisWorkbook.SaveCopyAs "C:\Backups\" & ThisWorkbook.Name
Sheets("Report").ExportAsFixedFormat _
Type:=xlTypePDF, Filename:="C:\Reports\Report.pdf"
Dim wb As Workbook, f As String
f = Dir("C:\Data\*.xlsx")
Do While f <> ""
Set wb = Workbooks.Open("C:\Data\" & f)
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Master").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
wb.Close False
f = Dir
Loop
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "manager@example.com"
.Subject = "Monthly Report"
.Body = "Please find the report attached."
.Attachments.Add "C:\Reports\Report.pdf"
.Send
End With
These 20 snippets cover 80% of what most professionals need to automate in Excel: loops, formatting, cleaning, reporting, and integration. The best part? You don’t need to memorize them — just keep them handy, and adapt them as needed.
Editor’s NoteAt ExcelGoodies, our VBA Macro Programming Course takes you beyond snippets — teaching you how to write, adapt, and combine code into complete automation solutions. With hands-on finance and reporting use cases, you’ll learn how to turn these building blocks into powerful, time-saving tools.
Because real productivity isn’t about knowing one trick — it’s about knowing how to make Excel work for you.
Courtesy: Excelgoodies Power Users.
VBA & Python
New
Next Batches Now Live