替换功能使对象不支持属性或方法

时间:2018-12-19 22:05:47

标签: excel vba excel-vba

直到今天,此行的VBA脚本一直运行良好     repStr = Replace(currentSID,“ t#”,“ SID _”)

替换功能显示 所有参数均为字符串。 currentSID =“ t#3520”

Sub AddSID(sh As Worksheet)
    Dim r As Long
    Dim c As Long
    Dim currentSID As String
    Dim maxRow As Long
    Dim repStr As String

    maxRow = sh.Cells(2000, 1).End(xlUp).Row
    For r = maxRow To 2 Step -1
        currentSID = sh.Cells(r, 1).Value
        repStr = Replace(currentSID, "t#", "SID_")
        sh.Cells(r, 1).Value = repStr
        currentSID = sh.Cells(r, 1).Value

0 个答案:

没有答案