|
- Sub 多重区域可拷贝否()
- Dim Rng As Range, DicC As Object, DicR As Object
- Dim Rng1 As Range, St$, pD As Boolean
- Set DicC = CreateObject("Scripting.Dictionary")
- Set DicR = CreateObject("Scripting.Dictionary")
- pD = True
- Set Rng = Selection
- For Each Rng1 In Rng.Areas
- Debug.Print Rng1.Address
- If Not DicR.exists(Rng1.Row) Then
- Set DicR(Rng1.Row) = CreateObject("Scripting.Dictionary")
- End If
- DicR(Rng1.Row)(Rng1.Rows.Count) = ""
- If DicR(Rng1.Row).Count > 1 Then pD = False
- If Not DicC.exists(Rng1.Column) Then
- Set DicC(Rng1.Column) = CreateObject("Scripting.Dictionary")
- End If
- DicC(Rng1.Column)(Rng1.Columns.Count) = ""
- If DicC(Rng1.Column).Count > 1 Then pD = False
- Next
- If DicR.Count * DicC.Count <> Rng.Areas.Count Then pD = False
- If pD Then MsgBox "可拷贝" Else MsgBox "不可拷贝"
- Set DicC = Nothing
- Set DicR = Nothing
- End Sub
复制代码 |
|