Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Range resize | Excel Programming | |||
Resize Range Question | Excel Programming | |||
Range Resize | Excel Programming | |||
Resize Range Problem | Excel Programming | |||
Resize and a question | Excel Programming |