程式在工作表事件區:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Tr As Range, Sr As Range
With Target
Set Tr = .Item(1).MergeArea
If Tr.Count = 1 Then Exit Sub
Cancel = True
With [AZ2].Resize(Tr.Rows.Count, Tr.Columns.Count)
Tr.Copy .Cells
.UnMerge
.Value = Tr(1).Value
Tr.Copy
.PasteSpecial Paste:=xlFormats
.Copy Tr
.EntireColumn.Delete
End With
Tr.Select
End With
End Sub