![]() |
Table Formatting by a Macro
Hi all,
I hope somebody can help me on creating a small and very helpful EXCEL macro. I have a excel document with table like content and I need to create a macro which will format each cell with <td*what ever the cell vale</td and each row with <tr*cells</tr Example a b c 1 2 5 <tr<tda</td<tdb</td<tdc</td</tr <tr<td1</td<td2</td<td5</td</tr if i can make apply this to selected range that will be much better Please help me................ THEJAN |
Table Formatting by a Macro
I assume you want to make an HTML page with a table of Excel
data. Try something like the following: Sub AAA() Dim FNum As Integer Dim FName As String Dim Rng As Range Dim Rw As Range Dim FullRange As Range Set FullRange = Range("A1:C3") '<<< CHANGE FName = "H:\Test.htm" '<<< CHANGE FNum = FreeFile() Open FName For Output As #FNum Print #FNum, "<HTML" Print #FNum, "<TABLE" For Each Rw In FullRange.Rows Print #FNum, "<TR" For Each Rng In Rw.Cells Print #FNum, "<TD" & Rng.Text & "</TD" Next Rng Print #FNum, "</TR" Next Rw Print #FNum, "</TABLE" Print #FNum, "</HTML" Close #FNum End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Thejan Mendis" wrote in message ... Hi all, I hope somebody can help me on creating a small and very helpful EXCEL macro. I have a excel document with table like content and I need to create a macro which will format each cell with <td*what ever the cell vale</td and each row with <tr*cells</tr Example a b c 1 2 5 <tr<tda</td<tdb</td<tdc</td</tr <tr<td1</td<td2</td<td5</td</tr if i can make apply this to selected range that will be much better Please help me................ THEJAN |
All times are GMT +1. The time now is 03:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com