0
我在這行得到錯誤我的VBA宏:VBA:「定義或對象定義的錯誤」在if和then功能
If Sheets("Check Foil").Cells(y, 15) = Sheets("Data").Cells(x, 19) And Sheets("Check Foil").Cells(y, 24).Value <> "0" Then
這是我的代碼:
x = 1
y = 16
Do
If Sheets("Check Foil").Cells(y, 15) = Sheets("Data").Cells(x, 19) And Sheets("Check Foil").Cells(y, 24).Value <> "0" Then
Sheets("Data").Cells(x, 21).Copy
Sheets("Check Foil").Cells(y, 21).PasteSpecial xlPasteAll
Sheets("Check Foil").Cells(y, 22) = "Anode Foil not scan completely"
With Sheets("Check Foil").Range(Sheets("Check Foil").Cells(y, 21), Sheets("Check Foil").Cells(y, 24)).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
y = y + 1
Else
Sheets("Check Foil").Cells(y, 22) = "Foil Info Not Found"
End If
x = x + 1
Loop Until Sheets("Check Foil").Cells(y, 15) = ""
Sheets("Check Foil").Range("M16:X1016").VerticalAlignment = xlCenter
Sheets("Check Foil").Range("M:M").HorizontalAlignment = xlCenter
Sheets("Check Foil").Range("N16:O1016").HorizontalAlignment = xlLeft
Sheets("Check Foil").Range("P16:V1016").HorizontalAlignment = xlRight
y = 16
Do
If Sheets("Check Foil").Cells(y, 24) <= Application.WorksheetFunction.Sum(Sheets("Check Foil").Cells(y, 23) - (Sheets("Check Foil").Cells(y, 23) * 0.1)) And Sheets("Check Foil").Cells(y, 24).Value <> "0" Then
Sheets("Check Foil").Range(Sheets("Check Foil").Cells(y, 13), Sheets("Check Foil").Cells(y, 24)).Interior.ColorIndex = 6
End If
y = y + 1
Loop Until Sheets("Check Foil").Cells(y, 14) = ""
Worksheets("Check Foil").Activate
ActiveSheet.Range("A1").Select
MsgBox "Program Complete Run"
End Sub
這條線可以得到同樣的錯誤:如果表( 「檢查箔」)細胞(Y,24)<= Application.WorksheetFunction細胞(y,23) - (細胞膜(「檢查箔」)細胞(y,23)* 0.1))和片(「檢查箔」)細胞(y, 24).Value <>「0」Then – Falhuddin
'x','y','Sheets(「Check Foil」)的值是什麼?單元格(y,15)','表格(數據) (x,19)'''Sheets(「Check Foil」)。細胞(y,24)'代碼崩潰時? – YowE3K