Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Creating named range in VBA problem

I have created the following line of code in the Workbook_Open event of a
workbook:

Application.Names.Add Name:="FormatTempITC105",
RefersTo:="FormatLine!$A$30:$IA$30"

After I open the workbook, if I check for the named range in the
Insert/Names/Defines, the name exists. If I look in the Name Box, it is not
listed.

The problem I have is that, if the named range is being created by the
Workbook_Open event, I get an error in the worksheet code using the name
range above. If I don't put the code in the Workbook_Open and create the
named range from the Insert/Name/Define, the worksheet code runs fine.

Is there something I am missing when creating the named range in the
Workbook_Open event code?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Creating named range in VBA problem


worksheets("formatline").Range("A30:AI30").Name :="FormatTempITC105"


"Billy B" wrote:

I have created the following line of code in the Workbook_Open event of a
workbook:

Application.Names.Add Name:="FormatTempITC105",
RefersTo:="FormatLine!$A$30:$IA$30"

After I open the workbook, if I check for the named range in the
Insert/Names/Defines, the name exists. If I look in the Name Box, it is not
listed.

The problem I have is that, if the named range is being created by the
Workbook_Open event, I get an error in the worksheet code using the name
range above. If I don't put the code in the Workbook_Open and create the
named range from the Insert/Name/Define, the worksheet code runs fine.

Is there something I am missing when creating the named range in the
Workbook_Open event code?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Creating named range in VBA problem

The formula you gave me did not work. After careful study I found out why
neither of ours worked: There needs to be an = in the named range:

worksheets("formatline").Range("A30:AI30").Name :="=FormatTempITC105"

"Patrick Molloy" wrote:


worksheets("formatline").Range("A30:AI30").Name :="FormatTempITC105"


"Billy B" wrote:

I have created the following line of code in the Workbook_Open event of a
workbook:

Application.Names.Add Name:="FormatTempITC105",
RefersTo:="FormatLine!$A$30:$IA$30"

After I open the workbook, if I check for the named range in the
Insert/Names/Defines, the name exists. If I look in the Name Box, it is not
listed.

The problem I have is that, if the named range is being created by the
Workbook_Open event, I get an error in the worksheet code using the name
range above. If I don't put the code in the Workbook_Open and create the
named range from the Insert/Name/Define, the worksheet code runs fine.

Is there something I am missing when creating the named range in the
Workbook_Open event code?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Creating named range in VBA problem

my error - qa typo

I wrote
worksheets("formatline").Range("A30:AI30").Name :="FormatTempITC105"


instead of
worksheets("formatline").Range("A30:AI30").Name ="FormatTempITC105"


"Billy B" wrote:

The formula you gave me did not work. After careful study I found out why
neither of ours worked: There needs to be an = in the named range:

worksheets("formatline").Range("A30:AI30").Name :="=FormatTempITC105"

"Patrick Molloy" wrote:


worksheets("formatline").Range("A30:AI30").Name :="FormatTempITC105"


"Billy B" wrote:

I have created the following line of code in the Workbook_Open event of a
workbook:

Application.Names.Add Name:="FormatTempITC105",
RefersTo:="FormatLine!$A$30:$IA$30"

After I open the workbook, if I check for the named range in the
Insert/Names/Defines, the name exists. If I look in the Name Box, it is not
listed.

The problem I have is that, if the named range is being created by the
Workbook_Open event, I get an error in the worksheet code using the name
range above. If I don't put the code in the Workbook_Open and create the
named range from the Insert/Name/Define, the worksheet code runs fine.

Is there something I am missing when creating the named range in the
Workbook_Open event code?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem creating a named range headly Excel Programming 7 July 28th 08 11:36 AM
Problem with creating a named range Alex Excel Programming 11 May 9th 06 03:41 AM
Creating a named range Gixxer_J_97[_2_] Excel Programming 4 December 7th 05 10:06 PM
Can I use named range in data range box when creating pie chart? BJackson Charts and Charting in Excel 2 August 17th 05 05:37 PM
Creating a Named Range using VB Adriaan van der Linde Excel Programming 4 December 5th 03 01:05 PM


All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"