Selection.AutoFill Destination:=Range("Cells(2, 5):Cells(i, 6)") 提示rang 作用与对象global失败
程序如下:SubMacro1()''格式计算DimiAsIntegerRange("E2").SelectActiveCell.FormulaR1C1="=VLOOKUP...
程序如下:
Sub Macro1()
'
'格式计算
Dim i As Integer
Range("E2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],工参!C[-4]:C[-3],2,0)"
Range("F2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],工参!C[-5]:C[-4],2,0)"
'公式复制
i = 2
If Sheets("sheet1").Cells(i, 1) <> "" Then
i = i + 1
End If
Range("E2:F2").Select
Selection.AutoFill Destination:=Range("Cells(2, 5):Cells(i, 6)") '该处出错
End Sub
等待大虾指教!! 展开
Sub Macro1()
'
'格式计算
Dim i As Integer
Range("E2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],工参!C[-4]:C[-3],2,0)"
Range("F2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],工参!C[-5]:C[-4],2,0)"
'公式复制
i = 2
If Sheets("sheet1").Cells(i, 1) <> "" Then
i = i + 1
End If
Range("E2:F2").Select
Selection.AutoFill Destination:=Range("Cells(2, 5):Cells(i, 6)") '该处出错
End Sub
等待大虾指教!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询