Last active
January 20, 2022 15:18
-
-
Save zafercavdar/80694e9d50d3a999c2ccb3dad889d840 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Sub groupTest() | |
ActiveSheet.Outline.SummaryRow = xlAbove | |
Dim sRng As Range | |
Dim eRng As Range | |
Dim rng As Range | |
Dim currRng As Range | |
Set currRng = Range("B2") | |
Set sRng = Range("B2") | |
Do While currRng.Value <> "" | |
If currRng.Value <> sRng.Value Or currRng.Offset(1).Value = "" Then | |
If currRng.Offset(1).Value = "" Then | |
Set eRng = currRng | |
Else | |
Set eRng = currRng.Offset(-1) | |
End If | |
Set rng = Range(sRng.Offset(1), eRng) | |
Debug.Print rng.Address | |
rng.EntireRow.Group | |
Set sRng = currRng | |
End If | |
Set currRng = currRng.Offset(1) | |
Loop | |
Debug.Print "done" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment