我在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