How to take out the data out in Excel ?

Hi Expert, There are a lot groups of data. below is two groups of data.  I want to take out the bold line and put them together. Any expert can give me some suggestion ? Thank you




interface GigabitEthernet2/9
 description  LAN
 switchport
 switchport access vlan 99
 switchport mode access
 shutdown
 spanning-tree portfast

interface GigabitEthernet4/4
 description - Inside
 switchport
 switchport access vlan 99
 switchport mode access
 spanning-tree portfast

i
eemoonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
What should the result look like?
eemoonAuthor Commented:
Thank you so much for your fast reply!

It should look like following after them are taken out:

interface GigabitEthernet2/9
interface GigabitEthernet4/4
...
Martin LissOlder than dirtCommented:
So this???

interface GigabitEthernet2/9
interface GigabitEthernet4/4
 description  LAN
 switchport
 switchport access vlan 99
 switchport mode access
 shutdown
 spanning-tree portfast

 description - Inside
 switchport
 switchport access vlan 99
 switchport mode access
 spanning-tree portfast
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

eemoonAuthor Commented:
Yes, that is what I want
Martin LissOlder than dirtCommented:
OK then, one more question. How do I recognize the group headers (like interface GigabitEthernet2/9)? Is there a blank line in front of all of them except the first one?
eemoonAuthor Commented:
1, we want the first line in each group, and there is one line space between two groups
2, after the first line, all lines are indented
Naresh PatelFinancial AdviserCommented:
I have one ready solution and it is not mine work, I had asked question in EE and I got solution. so please no need of points as it is not mine work. if Sir.Martin allow me to post ...it is UDF function. in that you can put IF formula with condition cell is bold or not and in return it will give you True or False. so applying to each row and sort them to find bold values in column .

Assuming sorting data in Excel.

Thanks
Martin LissOlder than dirtCommented:
Try this macro.

Sub GroupHeaders()
Dim lngLastRow As Long
Dim lngRow As Long

Application.ScreenUpdating = False

lngLastRow = Range("A1048576").End(xlUp).Row
lngNewRow = 2

For lngRow = lngLastRow To 2 Step -1
    ' Look for blank rows
    If WorksheetFunction.CountA(Rows(lngRow)) = 0 Then
        ' We found one so move the row below it (a header)
        ' to the top
        Rows(lngRow + 1).Select
        Selection.Cut
        Rows(2).Select
        Selection.Insert Shift:=xlDown
    End If
Next

Application.ScreenUpdating = True
End Sub

Open in new window

Martin LissOlder than dirtCommented:
if Sir.Martin allow me to post
Any person can post whatever answer they like.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eemoonAuthor Commented:
I got it due to your suggestion, Thank all of you.
Just paste it into Excel and sort it!
Naresh PatelFinancial AdviserCommented:
Thanks dude but you allotted points to me which is not required as I dint even posted solution. niways see below solution
Function IsCellBold(cellx As Range) As Boolean
    If cellx.Font.Bold Then
        IsCellBold = True
    Else
        IsCellBold = False
    End If
End Function


Function isCellBackground(cellx As Range) As Boolean
    If cellx.Interior.Color = RGB(255, 255, 255) Then
        isCellBackground = False
    Else
        isCellBackground = True
    End If
End Function

Open in new window




See attached WB it has solution for this question as well as for your next question.

Thanks
EE-Question---Format-Sort.xlsm
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.