View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Defining Range Name

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


"anshu" wrote:

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