Hey guys,
I've been having a problem with grouping using a Macro. I know you can just use the record macro feature, but in this case it will not work for me.
Here's an example of what my data looks like.
UWI UnitFlag PTType Start End
456 m F 1 2
456 m J 2 3
456 m F 2 3
789 m J 1 2
789 m J 4 5
This list is actually has 11000 rows so I think that using the record method would be very long. A
Anyways, I wanted to write a macro that did this:
If A1=A2 (in this case 456 and 456) then group rows 1 and 2 together and append to the next row and do the same
else next row
I'm pretty poor in writing code so please excuse the lack of syntax. If anyone could help me out with this, it would be greatly appreciated!
Thanks.
Grouping contiguous ranges without insertion of rows between groups will prove difficult.
have you considered just using XL's native Subtotal functionality ? to illustrate:
-- highlight your data
-- Data Tab on Ribbon -> Subtotal (use Default Settings for sake of demo)
you will in turn get your groups per UWI
(note in XL2007 Subtotals won't work with Tables - ie your source data must reside in a standard Range and not a Table)
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks