Defining Range Name

A

anshu

Hi All,

One more problem...

I am defining the range name in the column F after counting the number
of data items in Column F starting from F2 (stored in Count1). I am
using this code:


Range("F2").Select
Cells(2, "F").Resize(Count1, 1).Select
ActiveWorkbook.Names.Add Name:="InitType", RefersToR1C1:="=List!
R2C6:R11C6"

However, looks like the refers to column is static and always naming
F2:F11 range no matter what the count is...IS there any way I can
include Count1 Variable in the "Refers to" part as well

Thanks in advance,
Anshuman
 
G

Guest

Hi Anshuman,

If I have interpreted correctly what you are trying to do then try this and
see if it works for you:-

Range("F2").Select
Cells(2, "F").Resize(Count1, 1).Select
ActiveWorkbook.Names.Add Name:="InitType", RefersToR1C1:=Selection

You can replace the range with selection because you have selected it in the
previous line of code.

Regards,

OssieMac
 
A

anshu

Perfect OssieMac.....Thanks a lot

Hi Anshuman,

If I have interpreted correctly what you are trying to do then try this and
see if it works for you:-

Range("F2").Select
Cells(2, "F").Resize(Count1, 1).Select
ActiveWorkbook.Names.Add Name:="InitType", RefersToR1C1:=Selection

You can replace the range with selection because you have selected it in the
previous line of code.

Regards,

OssieMac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top