![]() |
how to give variable range
i need the code for doing this..please help
i= 2 to 20 (variable) ActiveWorkbook.Names.Add Name:="abc", RefersTorange= cells(1,1),cells(i,1) |
how to give variable range
i = 5
Set myrange = Range("A1", Cells(1, i)) ActiveWorkbook.Names.Add Name:="abc", RefersTo:="=" & myrange.Address "ezil" wrote: i need the code for doing this..please help i= 2 to 20 (variable) ActiveWorkbook.Names.Add Name:="abc", RefersTorange= cells(1,1),cells(i,1) |
how to give variable range
Better to use an offset formula such as =offset($a$1,0,0,counta($a:$a)) but
to answer. Sub namerng() mc = "b" lr = cells(Rows.Count, mc).End(xlUp).Row Range(cells(1, mc), cells(lr, mc)).Name = "abc" End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "ezil" wrote in message ... i need the code for doing this..please help i= 2 to 20 (variable) ActiveWorkbook.Names.Add Name:="abc", RefersTorange= cells(1,1),cells(i,1) |
how to give variable range
Range("A2").Resize(i - 1).Name = "abc" -- __________________________________ HTH Bob "ezil" wrote in message ... i need the code for doing this..please help i= 2 to 20 (variable) ActiveWorkbook.Names.Add Name:="abc", RefersTorange= cells(1,1),cells(i,1) |
All times are GMT +1. The time now is 12:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com