K
kittronald
I'm trying to create a defined name's Refersto range of
"Sheet1!$A$1:$A$5" using the variable below.
r = 5
Workbooks("Book1.xlsb").Names.Add Name:="Test",
RefersTo:=Sheets("Sheet1").Range("A1").Resize(r - 1, 0)
This doesn't work and gives a Run-time error '9': Subscript out of range
error.
What is the code to get the Refersto range properly setup ?
kittronald
"Sheet1!$A$1:$A$5" using the variable below.
r = 5
Workbooks("Book1.xlsb").Names.Add Name:="Test",
RefersTo:=Sheets("Sheet1").Range("A1").Resize(r - 1, 0)
This doesn't work and gives a Run-time error '9': Subscript out of range
error.
What is the code to get the Refersto range properly setup ?
kittronald