Excel VBA開発の専門スキル。VBAマクロ作成、Excel操作自動化、ワークブック処理時に使用。
Scanned 2/12/2026
Install via CLI
openskills install majiayu000/claude-skill-registry---
name: excel-vba
description: Excel VBA開発の専門スキル。VBAマクロ作成、Excel操作自動化、ワークブック処理時に使用。
user-invocable: true
argument-hint: "[task-description]"
---
# Excel VBA開発スキル
## 基本方針
- Option Explicit必須
- エラーハンドリング必須(On Error GoTo)
- 画面更新・計算の制御でパフォーマンス最適化
- 変数は明示的に型宣言
## 標準テンプレート
### Sub プロシージャ
```vba
Option Explicit
Public Sub ProcessData()
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
' 処理本体
CleanUp:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Exit Sub
ErrorHandler:
MsgBox "エラー: " & Err.Description, vbExclamation
Resume CleanUp
End Sub
```
## 命名規則
- モジュール: mod_機能名
- プロシージャ: 動詞_目的語
- 変数: キャメルケース(接頭辞付き: str, lng, rng等)
## よく使うパターン
### 最終行取得
```vba
Dim lastRow As Long
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
```
### 範囲ループ
```vba
Dim cell As Range
For Each cell In Range("A1:A" & lastRow)
' 処理
Next cell
```
### 配列処理(高速)
```vba
Dim data As Variant
data = Range("A1:Z1000").Value
' 配列で処理
Range("A1:Z1000").Value = data
```
## パフォーマンス最適化
```vba
' 処理開始時
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
' 処理終了時
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
```
## エラーハンドリングパターン
```vba
On Error GoTo ErrorHandler
' 処理
Exit Sub
ErrorHandler:
Dim errMsg As String
errMsg = "エラー番号: " & Err.Number & vbCrLf & _
"エラー内容: " & Err.Description
MsgBox errMsg, vbCritical, "エラー"
' 必要に応じてログ出力
End Sub
```
## Examples
- `/excel-vba 売上データを集計したい` → ワークシート操作+集計ロジックのテンプレートを提供
- `/excel-vba 複数のExcelを統合したい` → FileSystemObjectとワークブック操作のパターンを提供
- `マクロが遅い` → パフォーマンス最適化パターン(ScreenUpdating等)を適用
- `エラーでマクロが止まる` → エラーハンドリングテンプレートを提供
## Guidelines
- 必ず `Option Explicit` を宣言して暗黙の変数宣言を禁止
- すべてのプロシージャに `On Error GoTo ErrorHandler` を実装
- 大量データ処理時は配列に読み込んでからループ処理
- 処理前後で `ScreenUpdating` と `Calculation` を制御
- 変数名には型を示す接頭辞を付ける(str, lng, rng, ws等)
- 長いプロシージャは機能ごとに分割して可読性を確保
## 関連エージェント
- `@excel-vba-expert`: VBA開発専門家
No comments yet. Be the first to comment!
Create Mermaid diagrams for flowcharts, sequences, ERDs, and
Draft release notes and changelog entries from git history or merged PRs between two refs (tags/SHAs/branches), including breaking changes, migrations, and upgrade steps. Use when the user asks for release notes, changelog updates, or a GitHub Release draft.
Explain how claude-mem captures observations, when memory injection kicks in, and where data lives. Use when the user asks "how does claude-mem work?" or "what is this thing doing?".
Review a pull request or contribution deeply, explain it tutorial-style for a maintainer, and produce a polished report artifact such as HTML or Markdown. Use when asked to analyze a PR, explain a contributor's design decisions, compare it with similar systems, or prepare a merge recommendation.
Generate the stable Paperclip release changelog at releases/vYYYY.MDD.P.md by reading commits, changesets, and merged PR context since the last stable tag.