Excel Code Wizard

Code Instructions

  1. Open Excel and press ALT + F11 to open VBA Editor
  2. Right-click on your workbook name in the Project window
  3. Select Insert → Module
  4. Paste your code in the module window
  5. Press F5 to run the code
  6. Save your workbook as .xlsm to preserve macros

Example Code

Sub HelloWorld()
    ' Simple macro example
    Dim ws As Worksheet
    Set ws = ActiveSheet
    
    ws.Range("A1").Value = "Hello World!"
    ws.Range("A1").Font.Bold = True
    ws.Range("A1").Font.Color = RGB(255, 0, 0)
    
    MsgBox "Macro executed successfully!", vbInformation
End Sub