Excel2016で、以下の要件を満たすExcelマクロ(個人用マクロ)を作成してください。 なお、手動でマクロを実行することを想定しており、イベント受信型は想定していない。…
- User
Excel2016で、以下の要件を満たすExcelマクロ(個人用マクロ)を作成してください。 なお、手動でマクロを実行することを想定しており、イベント受信型は想定していない。
要件
- 範囲選択されたセルに対し、左端に罫線を引くこと。
- その罫線の色は、RGB(0,176,240)であること。
- その罫線のスタイルは、二重線であること。
Assistant
Sub AddLeftBorder() Dim selectedRange As Range ' 選択範囲を取得 Set selectedRange = Selection ' 選択範囲が空の場合、処理を中断 If selectedRange Is Nothing Then MsgBox "セルが選択されていません。", vbExclamation Exit Sub End If ' 左端に罫線を引く With selectedRange.Borders(xlEdgeLeft) .LineStyle = xlDouble ' 二重線 .Color = RGB(0, 176, 240) ' RGB(0,176,240) .Weight = xlThin ' 線の太さ (必要に応じて調整) End With End Sub
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.