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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
This should do

Code:
Sheets("Sheet1").Range("A2:A7").Name = "Range1"
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top