久々に
VBA書いたので残しておくw
Set ~思い出すのに3分かかったw
Sub main()
Dim SelectCell As RangeSet SelectCell = Range(“i2”)
SelectCell.ActivateWhile SelectCell.Value <> “”
SelectCell.Value = ReplaceHTML(SelectCell.Value)
Set SelectCell = SelectCell.Cells(2, 1)
SelectCell.ActivateWend
End Sub
Function ReplaceHTML(str As String) As String
Dim pos As Integer
Dim str1 As String
Dim str2 As String‘最初のTRまで検出する
pos = InStr(str, “</tr”)str1 = Left(str, pos)
str2 = Right(str, Len(str) – pos)str1 = Replace(str1, “<tr”, “<tr id=””st_head”” “, 1, -1, vbTextCompare)
str2 = Replace(str2, “<tr”, “<tr id=””st_date”” “, 1, -1, vbTextCompare)ReplaceHTML = str1 & str2
End Function