Update excell named range using VB

adrianr

New Member
Joined
Mar 28, 2011
Messages
4
Hello all,

Id just like to say thanks for all the help that you guys are giving it ha really helped me get off my feet on this self interest project.

I just have one last problem I would like to fix in my excel file.

I have a range defined using excel called "Range1"

Range1 is set on Sheet1 A1:A6
Sheets("Sheet1").Range("Range1") can be used to set the values of the range but what I want to do is set a new range.

When my VB scrip updates I would like to change the range (not the values) to A2:A7

I can only seem to find information on how to change the values not the range itself.

I've heard there is something like preserve? to keep the values.


Thanks
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
This should do

Code:
Sheets("Sheet1").Range("A2:A7").Name = "Range1"
 

adrianr

New Member
Joined
Mar 28, 2011
Messages
4
Thank you so very much..

Do you know where I can find out more about the commands for VB/Excel?

Is there a online SDK like java?
 

Watch MrExcel Video

Forum statistics

Threads
1,109,540
Messages
5,529,434
Members
409,876
Latest member
Akash Yadav
Top