我想使用替換函數僅替換MID
的確切位置,而不是單元格中的所有事件。例子:
Ex。我想在位置6(第一次發生)替換+++++###****###
中的###
,而不是第二次。只能在VBA中的MID位置替換
For Each c In .Columns(3).Cells
If c.Value = "" Then
Else
Do While Len(c.Value) < 20
c.Value = c.Value & " "
Loop
transNum = Mid(c.Value, 6, 3)
c.Value = Replace(c.Value, Mid(c.Value, 6, 3), "")
c.Value = "0" & transNum & c.Value
End If
y.Sheets(1).Range("E" & c.Row) = y.Sheets(1).Range("E" & c.Row) & c.Value
Next c
閱讀說明書。這是替換函數的基本用法 – dbmitch