ホーム > 未分類 > 久々に

久々に

VBA書いたので残しておくw
Set ~思い出すのに3分かかったw

Sub main()
Dim SelectCell As Range

Set SelectCell = Range(“i2″)
SelectCell.Activate

While SelectCell.Value <> “”

SelectCell.Value = ReplaceHTML(SelectCell.Value)

Set SelectCell = SelectCell.Cells(2, 1)
SelectCell.Activate

Wend

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

カテゴリー: 未分類 タグ:
  1. Shohei
    2010 年 4 月 2 日 20:00 | #1

    ていうかスコープ思いっきり間違ってるじゃねぇかwww

  1. トラックバックはまだありません。