vault backup: 2025-10-24
This commit is contained in:
+17
-4
@@ -3,9 +3,10 @@ id: excel-macros
|
||||
aliases: []
|
||||
tags:
|
||||
- destiny/permanent
|
||||
- status/draft
|
||||
- topic/software
|
||||
- type/guide
|
||||
- authorship/original
|
||||
- status/complete
|
||||
title: Excel Macros
|
||||
---
|
||||
# Excel Macros
|
||||
@@ -18,14 +19,20 @@ assuming a fresh Excel install.
|
||||
|
||||
## 1. Enable Developer Tools
|
||||
|
||||
Add the hidden-by-default "Developer Tools" menu to the ribbon.
|
||||
|
||||
```menu
|
||||
File > Options > Customize Ribbon
|
||||
```
|
||||
|
||||
On the right side, under `Main Tabs`, check `Developer`.
|
||||
|
||||
From the new menu you can access macros and VB projects.
|
||||
|
||||
## 2. Create `PERSONAL.XLSB`
|
||||
|
||||
Create an empty macro in your "Personal Macro Workbook".
|
||||
|
||||
```menu
|
||||
Developer > Code > Record Macro
|
||||
```
|
||||
@@ -33,20 +40,26 @@ Developer > Code > Record Macro
|
||||
Set `Store macro in:` to `Personal Macro Workbook`
|
||||
and click `OK`, then `Stop Recording`.
|
||||
|
||||
## 3.
|
||||
This will create your `PERSONAL.XLSB` workbook,
|
||||
a special workbook whose macros and other VB code
|
||||
can be accessed from any other workbook.
|
||||
|
||||
## 3. Create a New Macro
|
||||
|
||||
```menu
|
||||
Developer > Visual Basic
|
||||
```
|
||||
|
||||
In the pop-up window, navigate to and double-click
|
||||
"VBAProject (PERSONAL.XLSB)/Modules/Module1"
|
||||
`VBAProject (PERSONAL.XLSB)/Modules/Module1`
|
||||
|
||||
Erase the empty macro created in step 2
|
||||
and add desired macros here.
|
||||
and add any custom macros here.
|
||||
My favorite is provided below.
|
||||
|
||||
```vb
|
||||
' Use on a column of empty and non-empty cells.
|
||||
' Replace empty cells with the last non-empty cell's values
|
||||
Sub FillDownEmptyCells()
|
||||
Dim rng As Range
|
||||
Dim cell As Range
|
||||
|
||||
Reference in New Issue
Block a user