|
▼ON さん:
こんにちは
横入りすみません。
面白そうでしたので参加させてください。
こんな感じではどうでしょうか?
Sub test()
Dim rngBuf As Range, c As Range
For Each c In Selection
flgStyle = (c.HorizontalAlignment = xlCenterAcrossSelection)
flgValue = (c.Value <> "")
If flgStyle And flgValue Then
If rngBuf Is Nothing Then
Set rngBuf = c
Else
Debug.Print rngBuf.Address
Set rngBuf = c
End If
ElseIf flgStyle Then
Set rngBuf = Application.Union(rngBuf, c)
ElseIf Not rngBuf Is Nothing Then
Debug.Print rngBuf.Address
Set rngBuf = Nothing
End If
Next c
If Not rngBuf Is Nothing Then
Debug.Print rngBuf.Address
Set rngBuf = Nothing
End If
End Sub
|
|