ElanKattan
New Member
- Joined
- May 15, 2018
- Messages
- 1
I'm having trouble writing a VBA code to expand a set of rows that are collapsed in a group. While the absolute row numbers are variable, I'm able to obtain the top and bottom row #s that all my desired rows to expand would be contained between, as those rows always have a specific word in column A that I can find and extrapolate the row #. For example, finding the word "Accruals":
With ActiveSheet
Set FindTopRow = .Range("A:A").Find(What:="Ticker", LookIn:=xlValues, LookAt:=xlWhole)
End With
Dim TopRow As Long
TopRow = FindTopRow.Row
(Same code for lower limit, searches for the word "Accruals", sets the Long as "BottomRow")
I need all the rows in between the highest and lowest row to be expanded for the rest of my code to work. I've been trying to play around with the ShowDetail function, but I can't get it to run without an error. Essentially, I'm looking for a code that instructs all rows between two variable rows ("TopRow" and "BottomRow") to expand if not already expanded.
I would NOT like to expand all groups on the worksheet - I am able to do that, but I'm looking to only expand the group of rows in question.
Thanks in advance! Let me know if I can provide any more detail.
With ActiveSheet
Set FindTopRow = .Range("A:A").Find(What:="Ticker", LookIn:=xlValues, LookAt:=xlWhole)
End With
Dim TopRow As Long
TopRow = FindTopRow.Row
(Same code for lower limit, searches for the word "Accruals", sets the Long as "BottomRow")
I need all the rows in between the highest and lowest row to be expanded for the rest of my code to work. I've been trying to play around with the ShowDetail function, but I can't get it to run without an error. Essentially, I'm looking for a code that instructs all rows between two variable rows ("TopRow" and "BottomRow") to expand if not already expanded.
I would NOT like to expand all groups on the worksheet - I am able to do that, but I'm looking to only expand the group of rows in question.
Thanks in advance! Let me know if I can provide any more detail.