LoginSignup
8
9

More than 5 years have passed since last update.

Excelで空セルを上のセルの値で埋めるマクロ

Posted at

タイトルだけではよくわかりませんが、例えば

分類 機能名
認証 ログイン  
ログアウト
ユーザ管理 ユーザ登録
ユーザ更新
ユーザ削除

という表の分類の列の空セルを埋めて

分類 機能名
認証 ログイン  
認証 ログアウト
ユーザ管理 ユーザ登録
ユーザ管理 ユーザ更新
ユーザ管理 ユーザ削除

としたいときに使えるマクロです。

Sub Pad()

    Dim s As Object
    Dim str As String

    str = ""

    For Each s In Selection
        If (s.Value <> "") Then
            str = s.Value
        End If
        s.Value = str
    Next
End Sub

実際使うと下のようになります。
excel_pad1.gif

横方向にも使えます。
excel_pad2.gif

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9