我有一段VBA但是我按ALT+F11 把下列VBA的編碼打進去後,不能執行,請問是不是欠了些東西,因為按了之後出現了他叫我輸入 巨集名稱 才能執行,謝謝 本人是新手,一直使用的是 sub () 。
Sub ModifyColumn(sColum As String, sKey As String)
Dim rngBase As Range
Dim iCount As Integer
iCount = 0
Set rngBase = ActiveSheet.Range(sColum & "1")
While Len(rngBase.Offset(iCount, 0).Value)
With rngBase.Offset(iCount, 0)
If InStr(.Value, sKey) Then
.Offset(0, -2).Value = .Value
.Delete shift:=xlShiftToLeft
End If
End With
iCount = iCount + 1
Wend
End Sub |