0
VBAを使用してExcelの書式設定に基づいて行をグループ化しようとしていますが、グーグルでは2005年から同様の質問が表示されます。
ユーザーが投稿したコードは、行を選択するのに最適ですが、どうやら実際に行をグループ化するコードを取得できません。VBAフォーマットに基づいた行のグループ化
コード:
Sub GetSameFormattedRange()
Dim c As Range, r As Range, e As Range
Set e = Intersect(ActiveSheet.UsedRange, Columns(1))
SetFormatData
Set c = e.Find(What:="", SearchFormat:=True)
If Not c Is Nothing Then
Set r = c
firstAddress = c.Address
Do
Set r = Union(r, c)
Set c = e.FindNext(After:=c)
If Not c Is Nothing Then
If c.Address = firstAddress Then Exit Do
End If
Loop While Not c Is Nothing
End If
If Not r Is Nothing Then
MsgBox r.Address
End If
Application.FindFormat.Clear
End Sub
Sub SetFormatData()
Application.FindFormat.Clear
Application.FindFormat.Interior.Color = vbRed
Application.FindFormat.Locked = True
Application.FindFormat.FormulaHidden = False
End Sub
私の場合はApplication.FindFormat.Interior.Color = vbRed
はApplication.FindFormat.IndentLevel = 1
感謝されます!
素晴らしい作品です!それを微調整しなければならなかったが、答えに感謝する。それを行うもっと複雑な方法を見つけようと時間を費やす。 – GenTugorn