HTML <p> and <li> formula?

JackBTM

New Member
Joined
Apr 6, 2021
Messages
8
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi everyone,

I currently have the 2 formulas below

Bulk <p> </p> each paragraph:

Excel Formula:
Sub aTest()

    Dim rCell As Range, spl As Variant, i As Long

    For Each rCell In Selection

        spl = Split(rCell, Chr(10))

        For i = LBound(spl) To UBound(spl)

            If spl(i) <> "" Then

                spl(i) = Chr(60) & "p" & Chr(62) & spl(i) & Chr(60) & "/p" & Chr(62)

            End If

        Next i

        rCell = Join(spl, Chr(10))

    Next rCell

    Selection.ColumnWidth = 200

    Selection.EntireRow.AutoFit

    Selection.EntireColumn.AutoFit

End Sub

Bullet point each line:
Excel Formula:
Sub aTest()

    Dim rCell As Range, spl As Variant, i As Long

    For Each rCell In Selection

        spl = Split(rCell, Chr(10))

        For i = LBound(spl) To UBound(spl)

            spl(i) = Chr(60) & "li" & Chr(62) & spl(i) & Chr(60) & "/li" & Chr(62)

        Next i

        rCell = Join(spl, Chr(10))

    Next rCell

    Selection.ColumnWidth = 200

    Selection.EntireRow.AutoFit

    Selection.EntireColumn.AutoFit

End Sub

I have an excel document with 1000+ rows, each of these cells contain text like the below (copied from google as real info on the doc is confidential):

"Paragraphs are the building blocks of papers. Many students define paragraphs in terms of length: a paragraph is a group of at least five sentences, a paragraph is half a page long, etc. In reality, though, the unity and coherence of ideas among sentences is what constitutes a paragraph. A paragraph is defined as “a group of sentences or a single sentence that forms a unit” (Lunsford and Connors 116). Length and appearance do not determine whether a section in a paper is a paragraph. For instance, in some styles of writing, particularly journalistic styles, a paragraph can be just one sentence long. Ultimately, a paragraph is a sentence or group of sentences that support one main idea. In this handout, we will refer to this as the “controlling idea,” because it controls what happens in the rest of the paragraph.

It is a picturesque region, but I would advise visitors to avoid:


Bathing in the river
Driving in the town
The local tapas bar
"

I was wondering - if at all - it would be possible to "combine" the two so that it can <p> </p> the paragraph and single line below (formatted in italic), but bullet points the lines below (underlined) so that when it recognizes several lines below each other, it bullet points them?

Many thanks!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Is anyone able to help, please? At a loss here still trying to figure it out :(
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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