Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default New Range resize Question

Greetings,

I have a vertical range in a column called MyRange. I am trying to get it
resized to reflect items added to the bottom. I tried

With Range("MyRange").Resize(1,1)
.Parent.Range(.Item(1), End(xlUp)).Name = "MyRange"
End With

This gives me a cell. How do you get this to work? Any reference material
on how to do this?

Thanks in advance for your help!

Ray


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default New Range resize Question

Try:

Sub Test()
With Range("MyRange")(1, 1)
.Resize(.End(xlDown).Row - .Row + 1, _
Range("MyRange").Columns.Count).Name = "MyRange"
End With
End Sub

--

Vasant


"Ray Batig" wrote in message
nk.net...
Greetings,

I have a vertical range in a column called MyRange. I am trying to get it
resized to reflect items added to the bottom. I tried

With Range("MyRange").Resize(1,1)
.Parent.Range(.Item(1), End(xlUp)).Name = "MyRange"
End With

This gives me a cell. How do you get this to work? Any reference material
on how to do this?

Thanks in advance for your help!

Ray




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default New Range resize Question

You almost had it:

Sub Tester5()
Debug.Print Range("MyRange").Address

With Range("MyRange").Resize(1, 1)
.Parent.Range(.Item(1), .End(xlDown)).Name = "MyRange"
End With

Debug.Print Range("MyRange").Address
End Sub

Produced:

$A$1:$A$10
$A$1:$A$12

this would assume MyRange is more than one cell and it it is contiguous.

--
Regards,
Tom Ogilvy


"Ray Batig" wrote in message
nk.net...
Greetings,

I have a vertical range in a column called MyRange. I am trying to get it
resized to reflect items added to the bottom. I tried

With Range("MyRange").Resize(1,1)
.Parent.Range(.Item(1), End(xlUp)).Name = "MyRange"
End With

This gives me a cell. How do you get this to work? Any reference material
on how to do this?

Thanks in advance for your help!

Ray




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default New Range resize Question

Is this what u want ?

Range(Range("MyRange").Resize(1, 1), Range("MyRange").Resize(1,
1).End(xlUp)).Name = "MyRange"

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default New Range resize Question

Thanks Tom,

I have
If Range("MyRange").Cells.Count =1 then
goto skip
else
this new resize code.

That takes care of a single cell range. In this case the data is contiguous.
If the are blanks, how would you rewrite?

Thanks again!

Ray

Tom Ogilvy wrote in message
...
You almost had it:

Sub Tester5()
Debug.Print Range("MyRange").Address

With Range("MyRange").Resize(1, 1)
.Parent.Range(.Item(1), .End(xlDown)).Name = "MyRange"
End With

Debug.Print Range("MyRange").Address
End Sub

Produced:

$A$1:$A$10
$A$1:$A$12

this would assume MyRange is more than one cell and it it is contiguous.

--
Regards,
Tom Ogilvy


"Ray Batig" wrote in message
nk.net...
Greetings,

I have a vertical range in a column called MyRange. I am trying to get

it
resized to reflect items added to the bottom. I tried

With Range("MyRange").Resize(1,1)
.Parent.Range(.Item(1), End(xlUp)).Name = "MyRange"
End With

This gives me a cell. How do you get this to work? Any reference

material
on how to do this?

Thanks in advance for your help!

Ray








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default New Range resize Question

Sub Tester6()
Debug.Print Range("MyRange").Address

With Range("MyRange").Resize(1, 1)
.Parent.Range(.Item(1), _
.Parent.Cells(Rows.Count, .Column) _
.End(xlUp)).Name = "MyRange"
End With

Debug.Print Range("MyRange").Address
End Sub

--
Regards,
Tom Ogilvy


"Ray Batig" wrote in message
. net...
Thanks Tom,

I have
If Range("MyRange").Cells.Count =1 then
goto skip
else
this new resize code.

That takes care of a single cell range. In this case the data is

contiguous.
If the are blanks, how would you rewrite?

Thanks again!

Ray

Tom Ogilvy wrote in message
...
You almost had it:

Sub Tester5()
Debug.Print Range("MyRange").Address

With Range("MyRange").Resize(1, 1)
.Parent.Range(.Item(1), .End(xlDown)).Name = "MyRange"
End With

Debug.Print Range("MyRange").Address
End Sub

Produced:

$A$1:$A$10
$A$1:$A$12

this would assume MyRange is more than one cell and it it is contiguous.

--
Regards,
Tom Ogilvy


"Ray Batig" wrote in message
nk.net...
Greetings,

I have a vertical range in a column called MyRange. I am trying to get

it
resized to reflect items added to the bottom. I tried

With Range("MyRange").Resize(1,1)
.Parent.Range(.Item(1), End(xlUp)).Name = "MyRange"
End With

This gives me a cell. How do you get this to work? Any reference

material
on how to do this?

Thanks in advance for your help!

Ray








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
Range resize Ray Batig Excel Programming 4 September 7th 04 01:23 AM
Resize Range Question Ray Batig Excel Programming 3 August 31st 04 02:26 AM
Range Resize jacqui Excel Programming 2 April 6th 04 06:22 PM
Resize Range Problem ExcelMonkey[_16_] Excel Programming 3 January 23rd 04 11:15 PM
Resize and a question a Excel Programming 6 December 2nd 03 03:01 PM


All times are GMT +1. The time now is 03:03 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"