-
-
Save gouf/99b7947f6b7f187363c1 to your computer and use it in GitHub Desktop.
アクティブシートの結合されたセルの結合を解除して,すべてのセルの値を結合元のセルの値で埋めます。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' アクティブシートの結合されたセルの結合を解除して,すべてのセルの値を結合元のセルの値で埋めます。 | |
Public Sub Unmerge() | |
Dim OuterCell As Variant | |
Dim InnerCell As Variant | |
Dim Value As Variant | |
Dim Updating As Boolean ' 現在のスクリーン更新状態 | |
Updating = Application.ScreenUpdating | |
' スクリーン更新停止 | |
Application.ScreenUpdating = False | |
For Each OuterCell In ActiveSheet.UsedRange | |
Value = OuterCell.Value | |
For Each InnerCell In OuterCell.MergeArea | |
InnerCell.MergeCells = False | |
InnerCell.Value = Value | |
Next InnerCell | |
Next OuterCell | |
' スクリーン更新状態を元に戻す | |
Application.ScreenUpdating = Updating | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment