ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Names.Add - Range Syntax Issue (https://www.excelbanter.com/excel-programming/327980-names-add-range-syntax-issue.html)

Arturo

Names.Add - Range Syntax Issue
 
I have a variable that holds a number.
I have a start point for a named range that needs to go out the number of
columns based on that variable. The following works wonderfully for vertical
situations but I need that variable €śmovs€ť to denote the column not row.

movs = Sheets("WIP2").Range("I4").Value
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1:A" & movs)

Spastic morning,
Arturo


Toppers

Names.Add - Range Syntax Issue
 
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Columns(movs)

"Arturo" wrote:

I have a variable that holds a number.
I have a start point for a named range that needs to go out the number of
columns based on that variable. The following works wonderfully for vertical
situations but I need that variable €śmovs€ť to denote the column not row.

movs = Sheets("WIP2").Range("I4").Value
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1:A" & movs)

Spastic morning,
Arturo


Bob Phillips[_6_]

Names.Add - Range Syntax Issue
 
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1",Cells(
movs,100))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Arturo" wrote in message
...
I have a variable that holds a number.
I have a start point for a named range that needs to go out the number of
columns based on that variable. The following works wonderfully for

vertical
situations but I need that variable "movs" to denote the column not row.

movs = Sheets("WIP2").Range("I4").Value
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1:A" & movs)

Spastic morning,
Arturo




Arturo

Names.Add - Range Syntax Issue
 
The range's start point is A1 and needs to size to the column associated with
movs in the same row.
I still do not see How to incorporate movs

ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1:" & Columns(movs)
& "1")

Something is off with the R1C1 notation

Arturo


"Toppers" wrote:

ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Columns(movs)

"Arturo" wrote:

I have a variable that holds a number.
I have a start point for a named range that needs to go out the number of
columns based on that variable. The following works wonderfully for vertical
situations but I need that variable €śmovs€ť to denote the column not row.

movs = Sheets("WIP2").Range("I4").Value
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1:A" & movs)

Spastic morning,
Arturo


Arturo

Names.Add - Range Syntax Issue
 
Thank you both!

ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1", Cells(1, movs))

"Bob Phillips" wrote:

ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1",Cells(
movs,100))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Arturo" wrote in message
...
I have a variable that holds a number.
I have a start point for a named range that needs to go out the number of
columns based on that variable. The following works wonderfully for

vertical
situations but I need that variable "movs" to denote the column not row.

movs = Sheets("WIP2").Range("I4").Value
ActiveWorkbook.Names.Add Name:="TEST", RefersTo:=Range("A1:A" & movs)

Spastic morning,
Arturo






All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com