0
我正在使用Windows 7與Office 2013使用Mid來提取部分字符串,具體取決於條件。我得到以下代碼的RunTime Error 424:使用MID提取字符串:VBA運行時錯誤424:對象需要
RW = 1
Set c = ActiveSheet.Cells(6, 3)
While Not IsEmpty(c.Offset(RW, 0).Value)
c.Offset(RW, 3).Text = Mid(c.Offset(RW, 0).Text, 7, 2) ' Getting error on this line
If (Mid(c.Offset(RW, 0).Text, 3, 1) = "/") Then
Set c.Offset(RW, 1).Text = Mid(c.Offset(RW, 0).Text, 1, 2)
Set c.Offset(RW, 2).Text = Mid(c.Offset(RW, 0).Text, 4, 2)
ElseIf (Mid(c.Offset(RW, 0).Text, 3, 1) = "-") Then
Set c.Offset(RW, 1).Text = Mid(c.Offset(RW, 0).Text, 4, 2)
Set c.Offset(RW, 2).Text = Mid(c.Offset(RW, 0).Text, 1, 2)
End If
對此有何幫助?