I have looking for a vba to achieve the following, without success:
Before (Note: there are two styles with more than one sku (ACRE012 and BHF65)
[TABLE="class: grid, width: 380"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]style[/TD]
[TD="align: center"]sku[/TD]
[TD="align: center"]sku_to_style_count[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]ACRE01[/TD]
[TD]ACR10234[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]ACRE03[/TD]
[TD]ACR10435[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]ACRE04[/TD]
[TD]ACR10566[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]ACRE06[/TD]
[TD]ACR14537[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]ACRE012[/TD]
[TD]ACR10538[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]ACRE012[/TD]
[TD]ACR10539[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]BHF34[/TD]
[TD]BHF54365[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD]BHF12[/TD]
[TD]BHF04337[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD]BHF65[/TD]
[TD]BHF73953[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD]BHF65[/TD]
[TD]BHF73954[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD]BHF65[/TD]
[TD]BHF73955[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
After (Added added lines are in Bold)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="width: 36"][/TD]
[TD="width: 92, align: center"]A[/TD]
[TD="width: 123, align: center"]B[/TD]
[TD="width: 129, align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]style[/TD]
[TD="align: center"]sku[/TD]
[TD="align: center"]sku_to_style_count[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]ACRE01[/TD]
[TD]ACR10234[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]ACRE03[/TD]
[TD]ACR10435[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]ACRE04[/TD]
[TD]ACR10566[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]ACRE06[/TD]
[TD]ACR14537[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]ACRE012[/TD]
[TD]ACR10538[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]ACRE012[/TD]
[TD]ACR10539[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]8
[/TD]
[TD]ACRE012[/TD]
[TD]ACRE012[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD]BHF34[/TD]
[TD]BHF54365[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD]BHF12[/TD]
[TD]BHF04337[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD]BHF65[/TD]
[TD]BHF73953[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD]BHF65[/TD]
[TD]BHF73954[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD]BHF65[/TD]
[TD]BHF73955[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]14
[/TD]
[TD]BHF65[/TD]
[TD]BHF65[/TD]
[TD="align: center"]3[/TD]
[/TR]
</tbody>[/TABLE]
Is this achievable?
- Count for the number of unique in style Column. Place that count in sku_to_style_count column
- When there are more than one sku related to a style column, add a blank row after nth unique style
- Copy that style to the style Column and the sku column and also the Style Count to sku_to_style_count column.
Before (Note: there are two styles with more than one sku (ACRE012 and BHF65)
[TABLE="class: grid, width: 380"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]style[/TD]
[TD="align: center"]sku[/TD]
[TD="align: center"]sku_to_style_count[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]ACRE01[/TD]
[TD]ACR10234[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]ACRE03[/TD]
[TD]ACR10435[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]ACRE04[/TD]
[TD]ACR10566[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]ACRE06[/TD]
[TD]ACR14537[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]ACRE012[/TD]
[TD]ACR10538[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]ACRE012[/TD]
[TD]ACR10539[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]BHF34[/TD]
[TD]BHF54365[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD]BHF12[/TD]
[TD]BHF04337[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD]BHF65[/TD]
[TD]BHF73953[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD]BHF65[/TD]
[TD]BHF73954[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD]BHF65[/TD]
[TD]BHF73955[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
After (Added added lines are in Bold)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="width: 36"][/TD]
[TD="width: 92, align: center"]A[/TD]
[TD="width: 123, align: center"]B[/TD]
[TD="width: 129, align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]style[/TD]
[TD="align: center"]sku[/TD]
[TD="align: center"]sku_to_style_count[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]ACRE01[/TD]
[TD]ACR10234[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]ACRE03[/TD]
[TD]ACR10435[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]ACRE04[/TD]
[TD]ACR10566[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]ACRE06[/TD]
[TD]ACR14537[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]ACRE012[/TD]
[TD]ACR10538[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]ACRE012[/TD]
[TD]ACR10539[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]8
[/TD]
[TD]ACRE012[/TD]
[TD]ACRE012[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD]BHF34[/TD]
[TD]BHF54365[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD]BHF12[/TD]
[TD]BHF04337[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD]BHF65[/TD]
[TD]BHF73953[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD]BHF65[/TD]
[TD]BHF73954[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD]BHF65[/TD]
[TD]BHF73955[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]14
[/TD]
[TD]BHF65[/TD]
[TD]BHF65[/TD]
[TD="align: center"]3[/TD]
[/TR]
</tbody>[/TABLE]
Is this achievable?