Insert Borders Between Groups of Duplicate Data on First and Last Instances VBA, Function or Macro

ChrisOK

Well-known Member
Joined
Mar 26, 2003
Messages
601
Looking for VBA code, macro or function that will quickly place 'above and below' borders between "like groups of data" driven by what is found in COLUMN (A).

RULES:
1- INDEX, MATCH items in COL A that are alike. Since, A7, A8 and A9 are alike and grouped together based on their Column A content being the same, then
2 -Using the borders feature, put a border line along the TOP of the FIRST INSTANCE of the duplicate number/text, then place a border line along the BOTTOM of the LAST INSTANCE of the duplicate number/text found...
3 - Draw/border that line out through Column D. (I'd like the ability to define what column to end with if possible) because I may want it to extend to Column E or F in some cases to put notes out to the side of that grouping.

Example shown below. Tried to attach sample test file like previously, but not seeing that capability any more?
"BOM Worksheet"
ROW 4....COL A......COL B........COL C..........COL D.......
ROW 5....12345......ELEMENT....$7500.00........25%......
ROW 6....98473......BOLT.........$2900.00........95%......
_______________________________________________
ROW 7....45877......RING.........$2975.00.........85%......
ROW 8....45877......RING.........$2175.00.........55%......
ROW 9....45877......RING.........$2022.00.........15%......
_______________________________________________
ROW 10....34529......ROD..........$1450.00........65%......
ROW 11....61231......SPACER.....$2900.00........85%......
ROW 12....12348......ELEMENT...$6500.00........25%......
ROW 13....98473......BOLT.........$2900.00........95%......
ROW 14....65777......BOLT.........$2900.00........95%......

In advance, much appreciated!
Chris
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
bump

Looking for VBA code, macro or function that will quickly place 'above and below' borders between "like groups of data" driven by what is found in COLUMN (A).

RULES:
1- INDEX, MATCH items in COL A that are alike. Since, A7, A8 and A9 are alike and grouped together based on their Column A content being the same, then
2 -Using the borders feature, put a border line along the TOP of the FIRST INSTANCE of the duplicate number/text, then place a border line along the BOTTOM of the LAST INSTANCE of the duplicate number/text found...
3 - Draw/border that line out through Column D. (I'd like the ability to define what column to end with if possible) because I may want it to extend to Column E or F in some cases to put notes out to the side of that grouping.

Example shown below. Tried to attach sample test file like previously, but not seeing that capability any more?
"BOM Worksheet"
ROW 4....COL A......COL B........COL C..........COL D.......
ROW 5....12345......ELEMENT....$7500.00........25%......
ROW 6....98473......BOLT.........$2900.00........95%......
_______________________________________________
ROW 7....45877......RING.........$2975.00.........85%......
ROW 8....45877......RING.........$2175.00.........55%......
ROW 9....45877......RING.........$2022.00.........15%......
_______________________________________________
ROW 10....34529......ROD..........$1450.00........65%......
ROW 11....61231......SPACER.....$2900.00........85%......
ROW 12....12348......ELEMENT...$6500.00........25%......
ROW 13....98473......BOLT.........$2900.00........95%......
ROW 14....65777......BOLT.........$2900.00........95%......

In advance, much appreciated!
Chris
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top