naming ranges???

navyaa

Board Regular
Joined
Jul 7, 2002
Messages
223
i am writing a macro where i select a range using a value in another cell: i start at a region and then row and columns below it based on a count are selected.

I need to name the range that is selected.....and here is my code for selecting:
Range("RPTSET").Select
ActiveCell.Offset(rowOffset:=[Range("SETCNT").Value], columnOffset:=9).Activate


ANY SUGGESTIONS??
NAVYA
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
On 2002-09-13 11:38, navyaa wrote:
i am writing a macro where i select a range using a value in another cell: i start at a region and then row and columns below it based on a count are selected.

I need to name the range that is selected.....and here is my code for selecting:
Range("RPTSET").Select
ActiveCell.Offset(rowOffset:=[Range("SETCNT").Value], columnOffset:=9).Activate


ANY SUGGESTIONS??
NAVYA

Hi,
is this what you need?

Sub test()
'select
Range("RPTSET").Select
ActiveCell.Offset(rowOffset:=Range("SETCNT").Value, columnOffset:=9).Activate
'name the selected cell
ActiveWorkbook.Names.Add Name:="namedregion", RefersToR1C1:=ActiveCell

End Sub
 
Upvote 0
Thank you for your reply...

I am just going to try what you suggested...the only difference is its not just a single cell that is selected by the offset statement...its a range so will what u suggested work the same way for that??

This is the correct code for what im doing:
Range("NUM").Select
Range(ActiveCell, ActiveCell.Offset([SETCNT].Value, 9)).Select
ActiveWorkbook.Names.Add Name:="namedregion", RefersToR1C1:=ActiveCell

WILL THIS WORK??
 
Upvote 0
hi again,

Thank you very much...i just tried it and it works, i just replaced the activecell by selection.

Navya
 
Upvote 0

Forum statistics

Threads
1,222,436
Messages
6,166,020
Members
452,008
Latest member
Customlogoflipflops

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