Macro for creating basic HTML table? (from selected data)

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I wrote one for my own use... it recognises the following things:
- background color
- horizontal text alignment
- merged cells (vertical and horizontal)
- bold, italic, underlined

It only generates the text with the table tags included, not a complete html document, and outputs this to the Immediate window, nothing fancy, but it works fine for what I need...
If you have enough with these features, let me know, I'll post the code...
 
Upvote 0
thats more than enough i think.

I really just want to get the table with the padded grid lines so I can steal it and spruce it up elsewhere!

Thanks, can I get that code?
 
Upvote 0
If you select to record a macro and then use the office button you can look at the option to use save as other formats and then select the html from there. the code will look like this:

ActiveWorkbook.SaveAs Filename:="C:\Users\Trevor G\Documents\test.htm" _
, FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False

You will have a little extra to do, like changing activeworkbook to activesheet
 
Upvote 0
Okay.... here it is... you will need to put all this code in a module. Also, make sure that the workbook you put this in, has a reference to the Microsoft Forms 2.0 Object Library. This is needed for the functionality to put the generated table in the clipboard.
Usage: select a rectangular range, run macro, choose ConvertSelection, paste result wherever you need it...

PM me an email-address and I will send the workbook to you...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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