Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default creation of name range without selection of cells

I need to identify a range of cells in a column when the first cell is a
named range and the last cell is unknown.
Myvar = sheet1.range(€śnamed cell and then move down the column to last entry
(.End(xlDown)).select. I want to do this without selecting the cells. Is this
possible? I generally use a named range and when I need to add an entry
within the named range I just insert a new row and the new row is included in
my named range and my code can use all the data. In this case I cant insert
a new row but the data has room to grow.

--
Jim at Eagle
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default creation of name range without selection of cells


"Jim at Eagle" wrote in message
...
I need to identify a range of cells in a column when the first cell is a
named range and the last cell is unknown.
Myvar = sheet1.range("named cell and then move down the column to last
entry
(.End(xlDown)).select. I want to do this without selecting the cells. Is
this
possible? I generally use a named range and when I need to add an entry
within the named range I just insert a new row and the new row is included
in
my named range and my code can use all the data. In this case I can't
insert
a new row but the data has room to grow.

--
Jim at Eagle


This is a good example where a function comes in handy. I use this one
quite a bit.

Sub Test()

Dim c as Range
Dim MyRange as Range

Set c = Range("name")
Set MyRange = Range(c, rngLBOUND(c))

End Sub

Function rngLBOUND(start As Range) As Range

'Recieves a Range object.
'Returns a single cell range object that is the location of the bottom-most
value
'in the column occupied by the passed value.

Set rngLBOUND = start.Parent.Cells(Rows.Count, start.Column) _
.End(xlUp)

End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default creation of name range without selection of cells

I used the following
row1 = Sheet3.Range("B5").End(xlDown).Row
ActiveWorkbook.Names.Add Name:="task1summary", RefersToR1C1:= _
"=Summary!R5C2:R" & row1 & "C2"
ListBox2.RowSource = "task1Summary"

I wanted all within program

--
Jim at Eagle

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
duplicate listbox selection to range of cells? lozc Excel Programming 4 February 9th 06 01:02 AM
random selection from a range of cells tjb Excel Worksheet Functions 1 February 15th 05 06:34 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Creation of a range with no specified address Adrix[_2_] Excel Programming 2 April 21st 04 11:10 AM
Excel - Copy range of cells based on Combobox Selection Excel-erate2004 Excel Programming 2 April 3rd 04 05:35 PM


All times are GMT +1. The time now is 01:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"