PDA

View Full Version : Solved: what are these filter things called and how do you add them



CatDaddy
04-03-2012, 12:15 PM
there are these filters on the side of a worksheet i am trying to reproduce and i need to know how to add them in vba!

http://tinypic.com/r/9ux9op/5

xld
04-03-2012, 01:26 PM
It is data grouping, and done like so


Rows("2:5").Rows.Group

CatDaddy
04-03-2012, 01:42 PM
so if i wanted to make X groups based on empty cells in column A, if i do a loop and say group each one will it show up on the side in one set of groupings? or would each group get its own column on the side?

CatDaddy
04-03-2012, 02:43 PM
tried this
Dim cell as Range
Dim x1 as integer, x2 as integer, i as integer

x1 = 2
For i=1 to 12

For each cell in range("A" & x1 & ":A22")
if cell.value = "" then
x2 = cell.row
Rows(x1 & ":" & x2).Rows.Group
x1 = x2 + 1
Exit For
End if
Next i
Next cell

Aussiebear
04-04-2012, 04:50 PM
Have a look in Excel help regarding Grouping, then macro record the process.

CatDaddy
04-05-2012, 09:36 AM
thank you very much, how many times do i have to turn to the macro recorder before i remember how awesome it is? no sense trying to record a function whose name you dont even know though so thanks again to both of you!

cheers