Sub XL2HTML() 'http://www.herber.de/mailing/020598v.txt ' Hans W. Herber * Microsoft Excel MVP -- herber@herber.de 'Some unauthorized changes by D.McRitchie, msgbox, close' 'Modified to use selection range instead of sheet Dim r%, c%, nR%, nC% 'Worksheets(1).Select nR = Selection.Rows.Count nC = Selection.Columns.Count 'Possible additions: radio buttons, Row hdr, Col hdr, Shade hdr '(Include the default output file in browsers bookmarks/favorites) FileName = InputBox("Supply filename for HTML generated from " _ & "selected range", "Filename for XL2HTML", _ "c:\temp\XL2test.htm") Close #1 Open FileName For Output As 1 ' Print #1, "" Print #1, "" Print #1, "" For r = 1 To nR Print #1, "" For c = 1 To nC '--modified to add   and not mess up columns on errors x = Selection.cells(r, c) On Error Resume Next If Len(Trim(x)) = 0 Then x = " " Print #1, "" Next c Print #1, "" Next r Print #1, "
" & x & "
" Print #1, "" ' Print #1, "" Close #1 MsgBox "XL2HTML placed your HTML code in" & Chr(10) & FileName End Sub