Excel格式化HTML数据并写回到相同的单元性能问题

我有一个包含非格式化的HTML数据的列“A”的Excel。 要格式化这些数据,我遵循以下步骤:

1)从第一个单元格中取出非格式化的html数据并将其粘贴到Internet Explorer上,并将格式化的文本从html页面粘贴到excel 列“E” ( 带有标签的HTML文本在Excel单元格中进行格式化 )

2)从excel列“E”,从每行读取数据到最后一行,并粘贴到保存格式的原始单元 ,我使用下面的代码。

Sub ConcatenateRichText(Target As Range, Source As Range) Dim Cell As Range Dim i As Long Dim c As Long i = 1 With Target .Clear For Each Cell In Source .Value = .Value & vbLf & Cell.Value Next Cell .Value = Trim(.Value) End With For Each Cell In Source For c = 1 To Len(Cell.Value) With Target.Characters(i, 1).Font .Name = Cell.Characters(c, 1).Font.Name .FontStyle = Cell.Characters(c, 1).Font.FontStyle .Size = Cell.Characters(c, 1).Font.Size .Strikethrough = Cell.Characters(c, 1).Font.Strikethrough .Superscript = Cell.Characters(c, 1).Font.Superscript .Subscript = Cell.Characters(c, 1).Font.Subscript .OutlineFont = Cell.Characters(c, 1).Font.OutlineFont .Shadow = Cell.Characters(c, 1).Font.Shadow .Underline = Cell.Characters(c, 1).Font.Underline .ColorIndex = Cell.Characters(c, 1).Font.ColorIndex End With i = i + 1 Next c i = i + 1 Next Cell End Sub 

问题是这段代码花了太多的时间来格式化数据,对于54行,花了近10分钟…

有没有更好的解决scheme呢?

这里是链接完整的代码http://pastebin.com/fZbQPYbg

提前致谢

注意:在mrexcel.com上发布相同的问题。如果我收到任何信息,我会在这里更新