View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Weide Zhang Weide Zhang is offline
external usenet poster
 
Posts: 6
Default Save HTML as simple text in Excel cell?

Thanks, Peter, it really helps.

Weide

"Peter Grebenik" wrote:

Replace the code in module1 with the following code. Clicking the
button will process the cells that you have selected. Note that it
overwrites the original content of the cell.

Peter

Option Explicit

Sub test()
Dim strText As String
Dim rngCell As Range
Dim lCalcMode As Long

With Application
.ScreenUpdating = False
lCalcMode = .Calculation
.Calculation = xlCalculationManual
End With

For Each rngCell In Selection

With rngCell
strText = .Value
'only process a cell that contains ""
If InStr(strText, "") 0 Then
.ClearContents
WriteFormattedText rngCell, strText
.WrapText = True
End If
End With
Next

Application.Calculation = lCalcMode
End Sub