Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
grouping with vba
I have loaded a range (for example: A1:B5000):
Set staticRng = Range("A1:B1208") I need to Group based on Len() 3. For example, if cell A1 has 2 characters, then A2 - A4 has 3 characters group them (A2 - A4) together. Cell A5 might then only have two characters, and then A6 - A10 might have four characters - which should be grouped together (A6 - A10). (just an example, lengths will always differ) A1 - not grouped A2A --| A3A --| grouped A4A --| A5 - not grouped A6 --| A7 --| A8 --| grouped A9 --| A10 -| So basically, anything with a character length 3 group together with all other contiguous cells, until the chracter length changes. pseudocode: If the character length 3 Yes: Group with all contiguous rows that contain the same length No: Do not group I know you can group a static range using the "selection.rows.group" method. However, I'm not sure how to keep track of the range (contiguous rows with the same character length in "A") while cycling through the For Loop. Any help is appreciated! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
grouping with vba
Disregard......Using a for loop and the rows.group method, I was able to get
this working. (Thanks, Dave P.) "Excel_Newb" wrote: I have loaded a range (for example: A1:B5000): Set staticRng = Range("A1:B1208") I need to Group based on Len() 3. For example, if cell A1 has 2 characters, then A2 - A4 has 3 characters group them (A2 - A4) together. Cell A5 might then only have two characters, and then A6 - A10 might have four characters - which should be grouped together (A6 - A10). (just an example, lengths will always differ) A1 - not grouped A2A --| A3A --| grouped A4A --| A5 - not grouped A6 --| A7 --| A8 --| grouped A9 --| A10 -| So basically, anything with a character length 3 group together with all other contiguous cells, until the chracter length changes. pseudocode: If the character length 3 Yes: Group with all contiguous rows that contain the same length No: Do not group I know you can group a static range using the "selection.rows.group" method. However, I'm not sure how to keep track of the range (contiguous rows with the same character length in "A") while cycling through the For Loop. Any help is appreciated! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
To sum by grouping | Excel Discussion (Misc queries) | |||
grouping | New Users to Excel | |||
Grouping | Excel Worksheet Functions | |||
Grouping | Excel Discussion (Misc queries) | |||
Grouping | Excel Discussion (Misc queries) |