每当我运行此宏时,我都会得到:
编译错误:不支持对象库功能”,突出显示“设置ws1 =”。
发生了什么事?有什么事吗
谢谢
Sub Airpush()
'Define your variables.
Dim ws1 As Worksheet, ws2 As Worksheet, cel As Range, i As Long
'Assign your worksheet variables.
Set ws1 = ThisWorkbook.Sheets("CAMPAIGN_PLANNER")
Set ws2 = ThisWorkbook.Sheets("REPORT_DOWNLOAD")
'First loop through each cell in Sheet2, Column E, (start at row 2 to account
'for header row) to get the value to find in Sheet1, Column C.
For Each cel In ws2.Range("A2:A" & ws2.Range("A" & ws2.Rows.Count).End(xlUp).Row)
'Then loop through each cell in Sheet1, column C. If you get a match, then
'copy the value from Sheet2, column B, cel.row to Sheet1, Column S, i row.
For i = 2 To ws1.Range("L" & ws1.Rows.Count).End(xlUp).Row
If cel.Value = ws1.Cells(i, 3).Value Then
ws1.Cells(i, 3).Offset(, 16).Value = cel.Offset(, 3).Value
ws1.Cells(i, 3).Offset(, 15).Value = cel.Offset(, 4).Value
ws1.Cells(i, 3).Offset(, 17).Value = cel.Offset(, 2).Value
End If
Next i 'loops through every used cell in Column C for all matches
Next cel 'loop to the next cell in Sheets2, Columns E
End Sub
答案 0 :(得分:0)
我不确定问题出在哪里,但是当我在激活版本上重新打开excel时,宏工作正常,这表明该问题与只读版本有关。
感谢所有发表评论的人!