Fix Headers

ivandgreat

Board Regular
Joined
Jun 20, 2012
Messages
95
Hello,

Good day! I have a headers from my sheets as per below table, i wanted to fix it to be on a single cell.

ItemRoleMaxStorm




FrameDestination
Multicast


SizeEnableBandEnableBand
1





2





3





ItemRoleMaxStorm




FrameDestination
Multicast


SizeEnableBandEnableBand
1





2





<tbody>
</tbody>


It should only like as per below, combined the headers in a single cell and delete the excessive rows.


ItemRoleMax Frame SizeStorm Destination EnableStorm Destination BandStorm Multicast EnableStorm Multicast Band
1





2





3





ItemRoleMax Frame SizeStorm Destination EnableStorm Destination BandStorm Multicast EnableStorm Multicast Band
1
2

<tbody>
</tbody>



br,

ivan

 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try:

Code:
Sub Test()
    Dim LR As Long
    Dim r As Long
    With ActiveSheet
        LR = .Range("A" & .Rows.Count).End(xlUp).Row
        For r = LR To 1 Step -1
            If .Range("A" & r).Value = "Item" Then
                With .Range("A" & r & ":G" & r)
                    .Value = Array("Item", "Role", "Max Frame Size", "Storm Destination Enable", "Storm Destination Band", "Storm Multicast Enable", "Storm Multicast Band")
                    .HorizontalAlignment = xlCenter
                    .WrapText = True
                End With
                .Rows(r + 1).Resize(2).Delete
            End If
        Next r
    End With
End Sub
 
Upvote 0
@ Andew, Thanks for the code.

What if the other cell value is variable, as per below, what will i change to meet to have it in a single cell.

IndexItemMaxStorm
FrameDestinationMulticast
ByteEnableBandEnableStatus
1
2
3

<tbody>
</tbody>

br,
ivan
 
Upvote 0

Forum statistics

Threads
1,196,076
Messages
6,013,285
Members
441,759
Latest member
ab_

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