我要根据产品列表和下拉列表中的推出年份来提取计算得出的收入报告。报告显示索引功能不是循环(循环)列表,而是仅显示1个选择。
T
尝试使用方括号,不断获取
运行时错误'424',需要对象。
Sub Bridge()
Dim cntP, cntY, cntProduct, cntYear, cntRow As Variant
Const Output_Height As Integer = 4
cntRow = 1
Application.ScreenUpdating = False
'Clear the Connect rate sheet
Sheet41.range("A11:U300").Clear
cntP = Application.WorksheetFunction.CountA(range("Product_List")) 'Count the number of product
cntY = Application.WorksheetFunction.CountA(range("Product_Years")) 'Count the number of years
'For loop for each of the Products
For cntProduct = 1 To cntP
Prod_Name_Selection = Application.WorksheetFunction.Index([Product_Years], cntProduct)
'For loop for each of the years within the loop of each product
For cntYear = 1 To cntY
Year_Selection = Application.WorksheetFunction.Index([Product_Years], cntYear)
'Copy the Cartidge Count output to the Connect rate sheet
Sheet13.range("Bridge_table").Copy
Sheet41.range("C6").Offset(Output_Height * (cntRow - 1) + 5, 0).PasteSpecial Paste:=xlPasteColumnWidths
Sheet41.range("C6").Offset(Output_Height * (cntRow - 1) + 5, 0).PasteSpecial Paste:=xlPasteFormats
Sheet41.range("C6").Offset(Output_Height * (cntRow - 1) + 5, 0).PasteSpecial Paste:=xlPasteValues
cntRow = cntRow + 3
Next
Next
Application.ScreenUpdating = True
End Sub