我在VBA中有點新。我想要做的是在一行(n)中找到單詞「材料」,從上面複製它的所有單元格,並將它們粘貼到列A中的另一個表單中。arr2 - 列將使用相同的功能但具有不同的話。 從我的代碼,我不斷收到錯誤。你能幫我解決代碼嗎?查找「材質」,複製它的單元格並粘貼到另一個工作表中
Dim t As Range
n = InputBox("Row number of FIRST MATERIAL")
arr2 = Array("A", "D", "E", "O", "P", "S", "W", "Y", "AB")
Set t = Sheets("Project Parts Requisitioning").Rows(n).Find("*Material*", LookAt:=xlWhole)
If t Is Nothing Then
MsgBox ("Material was not found")
End If
If Not t Is Nothing Then
Sheets("Project Parts Requisitioning").Rows(n).Find("*Material*", LookAt:=xlWhole).End(xlDown).Copy
Sheets("GCC1").Column("A").PasteSpecial xlPasteValues
End If
什麼線你得到的錯誤?什麼是錯誤? – Zac
爲什麼你創建一個數組而不是在代碼中引用它? – Luuklag