我想刪除不等於選定的組合框值的行。我有下面的代碼,但我得到一個運行時錯誤424對象所需。任何人都可以協助刪除不等於組合框值的行嗎?
Dim wkss As Worksheet, wkJob As Worksheet
Dim i As Long
Set wkss = Sheets("TempWs6")
Set wsJob = Sheets("Job")
wkss.Select
For i = Cells(Rows.Count, 10).End(xlUp).Row To 1 Step -1
If Cells(i, 10) <> wsJob.ComboBox1.Value Then
wkss.Rows(i).Row.Delete
End If
Next i
非常感謝!
錯誤是否在'wsJob.ComboBox1.Value'行出現? – BruceWayne
我修改了一些代碼,但它發生在「wkss.Rows(i).Row.Delete」 – Chris2015
嘗試使用'wkss.Rows(i).EntireRow.Delete'。 – BruceWayne