Prompt Details
Model
Chat - (gpt-5.5)
Token size
345
Example input
[TASK_DESCRIPTION — describe in plain English what the macro should do]: Copy all rows where column C says "Pending" into Sheet2, then highlight those rows yellow on Sheet1
[SHEET_NAMES — e.g., "Sheet1 contains orders, Sheet2 is a summary"]: Sheet1 contains orders, Sheet2 is the destination
[COLUMN_DETAILS — e.g., "Column A = Date, Column B = Amount, Column C = Category"]: Column A = Date, Column B = Amount, Column C = Status
Example output
Option Explicit
Sub CopyPendingRows()
On Error GoTo ErrorHandler
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim lastRow As Long
Dim destRow As Long
Dim i As Long
Dim dataArr As Variant
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set wsSource = ThisWorkbook.Sheets("Sheet1")
Set wsDest = ThisWorkbook.Sheets("Sheet2")
' Find last used row in source sheet
lastRow = wsSource.Cells(wsSource.Rows.Count, "A").End(xlUp).Row
' Load entire dataset into memory for fast processing
dataArr = wsSource.Range("A2:C" & lastRow).Value
wsDest.Range("A2:C" & wsDest.Rows.Count).Clear
destRow = 2
For i = 1 To UBound(dataArr, 1)
If dataArr(i, 3) = "Pending" Then
wsDest.Cells(destRow, 1).Resize(1, 3).Value = _
Array(dataArr(i, 1), dataArr(i, 2), dataArr(i, 3))
wsSource.Rows(i + 1).Interior.Color = RGB(255, 255, 0)
destRow = destRow + 1
End If
Next i
MsgBox destRow - 2 & " rows copied to Sheet2.", vbInformation
GoTo Cleanup
ErrorHandler:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
Cleanup:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
--- HOW TO INSTALL ---
1. Press Alt+F11 to open the Visual Basic Editor
2. Click Insert → Module
3. Paste the code above
4. Press F5 to run, or assign to a button via Developer tab
--- WHAT THIS CODE DOES ---
This macro scans Column C of Sheet1 for rows marked "Pending", copies them to Sheet2, and highlights the original rows yellow. It uses array-based processing for speed and includes full error handling so it never crashes silently.
By purchasing this prompt, you agree to our terms of service
GPT-5.5
Stop wrestling with VBA syntax. Describe your task in plain English — this prompt returns a complete, production-ready macro with full error handling, inline comments, and speed optimizations for large datasets.
✓ Works with Claude & ChatGPT
✓ Includes step-by-step install guide (Alt+F11 walkthrough)
✓ Array-based loops for 100+ row datasets
✓ On Error handling so macros fail gracefully
Perfect for analysts and operations teams who need Excel automation without hiring a developer.
...more
Added 4 days ago
