How to convert formatted text to html in Excel

Rude86

New Member
Joined
Sep 12, 2016
Messages
4
Hi Guys,

Sorry if this has been covered I tried searching but couldn't come up with anything relevant.

I am having trouble finding a script to convert text in an excel cell to format into html.
The reason I need this done is I am importing product descriptions into a program and they only accept CSV format.
When I save the excel doc into csv it loses its formatting and just strings the text as 1 line with no space formatting.

EXAMPLE
[TABLE="width: 422"]
<tbody>[TR]
[TD="class: xl63, width: 422"]

Industry Specification

A5.1 E 6011

Features



-Fast freezing weld metal

-Thin flux coating

-Deep, forceful arc

-Versatile electrode



When saving this as CSV it just strings all the text as 1 line.
Is there a way of keeping the formatting when saving to csv?

Thanks in advance!



[TABLE="width: 461"]
<tbody>[TR]
[TD="class: xl65, width: 461"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
You are a legend!!

I have just tried this and it works great!

Thankyou very much this will save me a lot of time!

Hi, big up on that post, i got the exact same issue and i am manually adding <br> to sooo much product descriptions, its not doable manually...

i have no idea on how to apply this macro, i only know the basic of the recording system but no idea on how to apply a script.

if anyone have a more recent good idea on how to convert an excel file that has many spacings in cells to preserve them whenconverting unto csv?

p.s. is having a csv file per product category a good way to keep a simple database save from a basic selling website with 3000 products?

thank you for any answer :)
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
p.s.2. i mean this macro: (cant even make a forum quote working :O)

Sub Demo()
Application.ScreenUpdating = False
Dim xlCell As Range
For Each xlCell In ActiveSheet.UsedRange.Cells
With xlCell
If InStr(.Text, Chr(10)) > 0 Then
.Value = Replace(.Text, Chr(10), "< br >")
End If
End With
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
i have no idea on how to apply this macro, i only know the basic of the recording system but no idea on how to apply a script.
Simply open the VBA Editor (e.g. Alt-F11), then copy the code from here and paste it into the VBA Editor and make the code edits that have been suggested in post 6. You can then close the VBA Editor and run the code in exactly the same way you'd run a recorded macro.
 
Upvote 0
thank you very much i will try that monday at work, it would save me so much time on the passage from excel to csv to website :D
 
Upvote 0
when i run the code it tells me BASIC synthax error at the end of the third line: Range
any idea how to fix that?
thanx
 
Upvote 0
I can't see why you'd get such an error message unless you have a faulty Excel installation or you've made an error in replicating the code. I get no such error when copying/pasting it from here into the Excel VBE then running the code.
 
Upvote 0
well the code was well copied, i have no idea what is the issue, but i did find how to find and replace line breaks directly in the spreadsheet, much easyer then using a macro, wee ctrl+h and the magic opens :D thanx for the help though
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,112
Members
452,302
Latest member
TaMere

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