我在这个初学者问题上陷于困境。我想根据所附图片命名400个范围。名称为Range_1,Range_2等。错误是对当前区域的引用。
Sub NameRange_Add()
Dim RangeName As String
Dim Reference As String
Dim i As Integer
For i = 1 To 2
RangeName = "Range_" & i
Reference = ActiveCell.CurrentRegion.Select
Worksheets("Test").Names.Add Name:=RangeName, RefersTo:=Reference
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Next i
End Sub