首页 > 解决方案 > 对象 _Global 的范围 1004 失败

问题描述

我已经记录了一个宏,如果我使用新数据(它每个月都会改变),它会不断给我以下错误(带星号)。该宏与我创建宏的原始数据完美配合。我已经很长时间没有使用宏了,所以我希望能简单地描述一下该怎么做!谢谢

Range("AK5").Select
ActiveCell.FormulaR1C1 = "Received"
Range("AL5").Select
ActiveCell.FormulaR1C1 = "No. of Students"
Range("AM5").Select
ActiveCell.FormulaR1C1 = "Student Name"
Range("AN5").Select
ActiveCell.FormulaR1C1 = "Student ID"
Range("AO5").Select
ActiveCell.FormulaR1C1 = "Month"
Range("AP5").Select
ActiveCell.FormulaR1C1 = "Department"
Range("AQ5").Select
ActiveCell.FormulaR1C1 = "Type"
Range("AR5").Select
ActiveCell.FormulaR1C1 = "YoS"
**Range("Table1[[#Headers],[Received]:[YoS]]").Select**
Range("Table1[[#Headers],[YoS]]").Activate
With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .ThemeColor = xlThemeColorAccent4
    .TintAndShade = 0
    .PatternTintAndShade = 0
End With

标签: excelvbadebugging

解决方案


推荐阅读