Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Creating Name with variable

Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody would
help me getting round this probelm.

--
Thanx & regards,
Asif
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Creating Name with variable

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody would
help me getting round this probelm.

--
Thanx & regards,
Asif



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Creating Name with variable

Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$" &
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody would
help me getting round this probelm.

--
Thanx & regards,
Asif




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Creating Name with variable

I got an error in the formula. See if this sorts it

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" &
numNames + 2 & "),1)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Asif" wrote in message
...
Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$" &
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody
would
help me getting round this probelm.

--
Thanx & regards,
Asif






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Creating Name with variable

Hi Bob,

I have following statement now which is causing the same runtime error

ActiveWorkbook.Names.Item("vld" & sVldName).Delete

Above statement is before the assignment statements below.

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

I got an error in the formula. See if this sorts it

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" &
numNames + 2 & "),1)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Asif" wrote in message
...
Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$" &
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody
would
help me getting round this probelm.

--
Thanx & regards,
Asif








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating Name with variable

When you say it is "before the assignment statements below", do you mean it
is before this one?

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

In other words, do you mean you are trying to use sVldName **before** you
assign anything to it?

Rick


"Asif" wrote in message
...
Hi Bob,

I have following statement now which is causing the same runtime error

ActiveWorkbook.Names.Item("vld" & sVldName).Delete

Above statement is before the assignment statements below.

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

I got an error in the formula. See if this sorts it

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" &
numNames + 2 & "),1)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$" &
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName,
RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody
would
help me getting round this probelm.

--
Thanx & regards,
Asif







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Creating Name with variable

Please see below the whole block:

For numNames = 1 To NamesCount
sVldName = WorksheetFunction.Index(vldNames, numNames, 0)
ActiveWorkbook.Names.Item("vld" & sVldName).Delete
vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 &
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" & numNames + 2 & "),1)"
ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula
Next numNames
--
Thanx & regards,
Asif


"Rick Rothstein (MVP - VB)" wrote:

When you say it is "before the assignment statements below", do you mean it
is before this one?

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

In other words, do you mean you are trying to use sVldName **before** you
assign anything to it?

Rick


"Asif" wrote in message
...
Hi Bob,

I have following statement now which is causing the same runtime error

ActiveWorkbook.Names.Item("vld" & sVldName).Delete

Above statement is before the assignment statements below.

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

I got an error in the formula. See if this sorts it

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" &
numNames + 2 & "),1)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$" &
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName,
RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if somebody
would
help me getting round this probelm.

--
Thanx & regards,
Asif








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Creating Name with variable

Don't bother deleting it, not necessary to re-create it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Asif" wrote in message
...
Please see below the whole block:

For numNames = 1 To NamesCount
sVldName = WorksheetFunction.Index(vldNames, numNames, 0)
ActiveWorkbook.Names.Item("vld" & sVldName).Delete
vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 &
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" & numNames + 2 &
"),1)"
ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula
Next numNames
--
Thanx & regards,
Asif


"Rick Rothstein (MVP - VB)" wrote:

When you say it is "before the assignment statements below", do you mean
it
is before this one?

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

In other words, do you mean you are trying to use sVldName **before** you
assign anything to it?

Rick


"Asif" wrote in message
...
Hi Bob,

I have following statement now which is causing the same runtime error

ActiveWorkbook.Names.Item("vld" & sVldName).Delete

Above statement is before the assignment statements below.

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

I got an error in the formula. See if this sorts it

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" &
numNames + 2 & "),1)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$"
&
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in
my
addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName,
RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if
somebody
would
help me getting round this probelm.

--
Thanx & regards,
Asif










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Creating Name with variable

Thank you Bob. This is working now.

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

Don't bother deleting it, not necessary to re-create it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Asif" wrote in message
...
Please see below the whole block:

For numNames = 1 To NamesCount
sVldName = WorksheetFunction.Index(vldNames, numNames, 0)
ActiveWorkbook.Names.Item("vld" & sVldName).Delete
vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 &
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" & numNames + 2 &
"),1)"
ActiveWorkbook.Names.Add Name:="vld" & sVldName, RefersTo:=vldFormula
Next numNames
--
Thanx & regards,
Asif


"Rick Rothstein (MVP - VB)" wrote:

When you say it is "before the assignment statements below", do you mean
it
is before this one?

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

In other words, do you mean you are trying to use sVldName **before** you
assign anything to it?

Rick


"Asif" wrote in message
...
Hi Bob,

I have following statement now which is causing the same runtime error

ActiveWorkbook.Names.Item("vld" & sVldName).Delete

Above statement is before the assignment statements below.

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

I got an error in the formula. See if this sorts it

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B:$B,Data! $I$" &
numNames + 2 & "),1)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Asif" wrote in message
...
Here are the definitions of variables:

Dim vldFormula As String, sVldName As String

sVldName = WorksheetFunction.Index(vldNames, numNames, 0)

vldFormula = "=OFFSET(Data!$B$2,MATCH(Data!$I$" & numNames + 2 & _
",Data!$B$3:$B$65536,0),3,COUNTIF(Data!$B$B,Data!$ I$"
&
numNames + 2 & "),1)"

--
Thanx & regards,
Asif


"Bob Phillips" wrote:

What is in vldName and vldFormula?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in
my
addy)

"Asif" wrote in message
...
Hi there,

I am trying to create Names with the following statement:

ActiveWorkbook.Names.Add Name:="vld" & sVldName,
RefersTo:=vldFormula

I keep getting the runtime error 1004. I will appreciate if
somebody
would
help me getting round this probelm.

--
Thanx & regards,
Asif











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
Creating a value from a variable result Darren Excel Discussion (Misc queries) 1 April 19th 10 06:43 PM
Creating a Variable Range Uninvisible Excel Programming 2 October 25th 07 01:29 PM
creating a variable Abe New Users to Excel 1 April 15th 06 06:41 AM
Macro Creating Variable and using variable in a SQL statement Jimmy Excel Programming 4 October 25th 04 02:36 AM
Macro Creating a variable which is to be used in a SQL in the Mac Jimmy Excel Programming 0 October 25th 04 01:21 AM


All times are GMT +1. The time now is 04:35 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"