Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
2007 Excel Table and Pivot Table Formatting | Excel Discussion (Misc queries) | |||
Excel 2007 Macro specific table to generic table? | Excel Discussion (Misc queries) | |||
Conditional formatting in a table is lost on table refresh | Excel Worksheet Functions | |||
Pivot Table border formatting and pivot chart formatting | Excel Discussion (Misc queries) | |||
Steps from Macro recorder for Pivot table will not run as a Macro | Excel Programming |