#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default vlookup problem

Hello,
I am editing a macro in VB under Excel 2002.
I have created this function

verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

When I call it in my macro, it's so made.
- cella is "A" & a progressive number (for...next)
- foglio is a worksheet on the same file
- area is a defined range in foglio (a named range)
- colonna is a simple number, of course

What I need to do is to say: if you don't find 'cella' in foglio!area look
for it in another foglio!area (where you of course will find it).
When the value in 'cella' is found in the first foglio!area it functions
correctly.
But if the value is not found, I get an error:

Run-time error '1004'
Vlookup property for the class WorksheetFunction not found (or similar, I
get the message in italian).

How could I solve the problem?
Thank you.

Alessandro
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default vlookup problem

Hi Alessandro,

Shouldn't you use Range("area")? Or is area a variable that contains the name of the range?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"Alessandro" wrote in message ...
| Hello,
| I am editing a macro in VB under Excel 2002.
| I have created this function
|
| verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
| Sheets(foglio).Range(area), colonna, False)
|
| When I call it in my macro, it's so made.
| - cella is "A" & a progressive number (for...next)
| - foglio is a worksheet on the same file
| - area is a defined range in foglio (a named range)
| - colonna is a simple number, of course
|
| What I need to do is to say: if you don't find 'cella' in foglio!area look
| for it in another foglio!area (where you of course will find it).
| When the value in 'cella' is found in the first foglio!area it functions
| correctly.
| But if the value is not found, I get an error:
|
| Run-time error '1004'
| Vlookup property for the class WorksheetFunction not found (or similar, I
| get the message in italian).
|
| How could I solve the problem?
| Thank you.
|
| Alessandro


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default vlookup problem

I say area (and not "area") because area is a parameter of my function.
However in the resulting command it appears like "area".

"Niek Otten" wrote:

Hi Alessandro,

Shouldn't you use Range("area")? Or is area a variable that contains the name of the range?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"Alessandro" wrote in message ...
| Hello,
| I am editing a macro in VB under Excel 2002.
| I have created this function
|
| verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
| Sheets(foglio).Range(area), colonna, False)
|
| When I call it in my macro, it's so made.
| - cella is "A" & a progressive number (for...next)
| - foglio is a worksheet on the same file
| - area is a defined range in foglio (a named range)
| - colonna is a simple number, of course
|
| What I need to do is to say: if you don't find 'cella' in foglio!area look
| for it in another foglio!area (where you of course will find it).
| When the value in 'cella' is found in the first foglio!area it functions
| correctly.
| But if the value is not found, I get an error:
|
| Run-time error '1004'
| Vlookup property for the class WorksheetFunction not found (or similar, I
| get the message in italian).
|
| How could I solve the problem?
| Thank you.
|
| Alessandro



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default vlookup problem

It's normal in Not found case. You have to use an On Error structure to
separate Found and Not found cases, something like this:

verticale =0 'or "" depending on data type of colonna
On error Resume Next
verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

if verticale = 0 then
' Not found cases
Else
' Found cases
End if

Regards,
Stefi


€˛Alessandro€¯ ezt Ć*rta:

Hello,
I am editing a macro in VB under Excel 2002.
I have created this function

verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

When I call it in my macro, it's so made.
- cella is "A" & a progressive number (for...next)
- foglio is a worksheet on the same file
- area is a defined range in foglio (a named range)
- colonna is a simple number, of course

What I need to do is to say: if you don't find 'cella' in foglio!area look
for it in another foglio!area (where you of course will find it).
When the value in 'cella' is found in the first foglio!area it functions
correctly.
But if the value is not found, I get an error:

Run-time error '1004'
Vlookup property for the class WorksheetFunction not found (or similar, I
get the message in italian).

How could I solve the problem?
Thank you.

Alessandro

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default vlookup problem

I thought that there was a parameter in vlookup in this cases.
However, I have solved my problem in the way that you suggest.
Thank you.

"Stefi" wrote:

It's normal in Not found case. You have to use an On Error structure to
separate Found and Not found cases, something like this:

verticale =0 'or "" depending on data type of colonna
On error Resume Next
verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

if verticale = 0 then
' Not found cases
Else
' Found cases
End if

Regards,
Stefi


€˛Alessandro€¯ ezt Ć*rta:

Hello,
I am editing a macro in VB under Excel 2002.
I have created this function

verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

When I call it in my macro, it's so made.
- cella is "A" & a progressive number (for...next)
- foglio is a worksheet on the same file
- area is a defined range in foglio (a named range)
- colonna is a simple number, of course

What I need to do is to say: if you don't find 'cella' in foglio!area look
for it in another foglio!area (where you of course will find it).
When the value in 'cella' is found in the first foglio!area it functions
correctly.
But if the value is not found, I get an error:

Run-time error '1004'
Vlookup property for the class WorksheetFunction not found (or similar, I
get the message in italian).

How could I solve the problem?
Thank you.

Alessandro



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default vlookup problem

You are welcome! Thanks for the feedback!
Stefi

€˛Alessandro€¯ ezt Ć*rta:

I thought that there was a parameter in vlookup in this cases.
However, I have solved my problem in the way that you suggest.
Thank you.

"Stefi" wrote:

It's normal in Not found case. You have to use an On Error structure to
separate Found and Not found cases, something like this:

verticale =0 'or "" depending on data type of colonna
On error Resume Next
verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

if verticale = 0 then
' Not found cases
Else
' Found cases
End if

Regards,
Stefi


€˛Alessandro€¯ ezt Ć*rta:

Hello,
I am editing a macro in VB under Excel 2002.
I have created this function

verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

When I call it in my macro, it's so made.
- cella is "A" & a progressive number (for...next)
- foglio is a worksheet on the same file
- area is a defined range in foglio (a named range)
- colonna is a simple number, of course

What I need to do is to say: if you don't find 'cella' in foglio!area look
for it in another foglio!area (where you of course will find it).
When the value in 'cella' is found in the first foglio!area it functions
correctly.
But if the value is not found, I get an error:

Run-time error '1004'
Vlookup property for the class WorksheetFunction not found (or similar, I
get the message in italian).

How could I solve the problem?
Thank you.

Alessandro

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default vlookup problem

You simply deserved it :)
I'm sorry to see that many threads here around miss a rating.

"Stefi" wrote:

You are welcome! Thanks for the feedback!
Stefi

€˛Alessandro€¯ ezt Ć*rta:

I thought that there was a parameter in vlookup in this cases.
However, I have solved my problem in the way that you suggest.
Thank you.

"Stefi" wrote:

It's normal in Not found case. You have to use an On Error structure to
separate Found and Not found cases, something like this:

verticale =0 'or "" depending on data type of colonna
On error Resume Next
verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)
if verticale = 0 then
' Not found cases
Else
' Found cases
End if

Regards,
Stefi


€˛Alessandro€¯ ezt Ć*rta:

Hello,
I am editing a macro in VB under Excel 2002.
I have created this function

verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

When I call it in my macro, it's so made.
- cella is "A" & a progressive number (for...next)
- foglio is a worksheet on the same file
- area is a defined range in foglio (a named range)
- colonna is a simple number, of course

What I need to do is to say: if you don't find 'cella' in foglio!area look
for it in another foglio!area (where you of course will find it).
When the value in 'cella' is found in the first foglio!area it functions
correctly.
But if the value is not found, I get an error:

Run-time error '1004'
Vlookup property for the class WorksheetFunction not found (or similar, I
get the message in italian).

How could I solve the problem?
Thank you.

Alessandro

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default vlookup problem

Perhaps newsgroup software should generate an extra line at the end of posts:

"PLEASE RATE THIS POST!"

Stefi


€˛Alessandro€¯ ezt Ć*rta:

You simply deserved it :)
I'm sorry to see that many threads here around miss a rating.

"Stefi" wrote:

You are welcome! Thanks for the feedback!
Stefi

€˛Alessandro€¯ ezt Ć*rta:

I thought that there was a parameter in vlookup in this cases.
However, I have solved my problem in the way that you suggest.
Thank you.

"Stefi" wrote:

It's normal in Not found case. You have to use an On Error structure to
separate Found and Not found cases, something like this:

verticale =0 'or "" depending on data type of colonna
On error Resume Next
verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)
if verticale = 0 then
' Not found cases
Else
' Found cases
End if

Regards,
Stefi


€˛Alessandro€¯ ezt Ć*rta:

Hello,
I am editing a macro in VB under Excel 2002.
I have created this function

verticale = Application.WorksheetFunction.VLookup(Range(cella) .Text,
Sheets(foglio).Range(area), colonna, False)

When I call it in my macro, it's so made.
- cella is "A" & a progressive number (for...next)
- foglio is a worksheet on the same file
- area is a defined range in foglio (a named range)
- colonna is a simple number, of course

What I need to do is to say: if you don't find 'cella' in foglio!area look
for it in another foglio!area (where you of course will find it).
When the value in 'cella' is found in the first foglio!area it functions
correctly.
But if the value is not found, I get an error:

Run-time error '1004'
Vlookup property for the class WorksheetFunction not found (or similar, I
get the message in italian).

How could I solve the problem?
Thank you.

Alessandro

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
VLOOKUP problem Seeking help Excel Worksheet Functions 1 August 8th 06 09:16 AM
VLOOKUP Problem Ian Excel Discussion (Misc queries) 3 April 6th 06 06:47 PM
Vlookup problem mariomaf Excel Worksheet Functions 11 January 5th 06 02:49 PM
VLOOKUP Problem MParham Setting up and Configuration of Excel 1 April 22nd 05 08:09 PM
VLOOKUP problem Wazooli Excel Discussion (Misc queries) 5 March 26th 05 01:52 PM


All times are GMT +1. The time now is 03:49 AM.

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

About Us

"It's about Microsoft Excel"