Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default "Unable to get the Hlookup property" VBA

Can't get this to work. I am trying to look up a value in the first
dimension of an array called NumberSetArray. Keep getting the "Unable to get
the Hlookup property" error.

?Application.WorksheetFunction.HLookup(7, NumberSetArray, 1, False)

I know the array has a 7 in it first dimension as seen below.
?NumberSetArray(0,0)
7


Is the problem due to the third term in the Hlookup Function?

Thanks

EM


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default "Unable to get the Hlookup property" VBA

I get this if the value to be looked up isn't present.

Do you really mean to look up the 7 itself?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ExcelMonkey" wrote in message ...
| Can't get this to work. I am trying to look up a value in the first
| dimension of an array called NumberSetArray. Keep getting the "Unable to get
| the Hlookup property" error.
|
| ?Application.WorksheetFunction.HLookup(7, NumberSetArray, 1, False)
|
| I know the array has a 7 in it first dimension as seen below.
| ?NumberSetArray(0,0)
| 7
|
|
| Is the problem due to the third term in the Hlookup Function?
|
| Thanks
|
| EM
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default "Unable to get the Hlookup property" VBA

Yes. I am looking up a value in an array that is getting bigger after each
successive loop. There will be instances where the value is in fact not in
the array. I think I need to wrap some error handling around it so that if
it fails it does not stop the code.

EM

"Niek Otten" wrote:

I get this if the value to be looked up isn't present.

Do you really mean to look up the 7 itself?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ExcelMonkey" wrote in message ...
| Can't get this to work. I am trying to look up a value in the first
| dimension of an array called NumberSetArray. Keep getting the "Unable to get
| the Hlookup property" error.
|
| ?Application.WorksheetFunction.HLookup(7, NumberSetArray, 1, False)
|
| I know the array has a 7 in it first dimension as seen below.
| ?NumberSetArray(0,0)
| 7
|
|
| Is the problem due to the third term in the Hlookup Function?
|
| Thanks
|
| EM
|
|



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default "Unable to get the Hlookup property" VBA

I am thinking along the lines of something like this:

NumExists = Application.WorksheetFunction.HLookup(RowNumberArr ay(X),
NumberSetArray, 2, False)
If Not IsError(NumExists) Then
Do Something
End if
Not sure if I need an On Error/Resume stmt to make this work.

EM

"ExcelMonkey" wrote:

Yes. I am looking up a value in an array that is getting bigger after each
successive loop. There will be instances where the value is in fact not in
the array. I think I need to wrap some error handling around it so that if
it fails it does not stop the code.

EM

"Niek Otten" wrote:

I get this if the value to be looked up isn't present.

Do you really mean to look up the 7 itself?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ExcelMonkey" wrote in message ...
| Can't get this to work. I am trying to look up a value in the first
| dimension of an array called NumberSetArray. Keep getting the "Unable to get
| the Hlookup property" error.
|
| ?Application.WorksheetFunction.HLookup(7, NumberSetArray, 1, False)
|
| I know the array has a 7 in it first dimension as seen below.
| ?NumberSetArray(0,0)
| 7
|
|
| Is the problem due to the third term in the Hlookup Function?
|
| Thanks
|
| EM
|
|



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default "Unable to get the Hlookup property" VBA

Here is the dilemma. The Hlookup should at time find no value. However when
this happens the code fails stating Unable to get the Hlookup property. I
put an On Error stmt in do that the code would still loop. The hope being
that the IsErorr function would still pick up the error even thoughe code is
looping. However, the IsError stmt is always TRUE indicating there is never
an error which I know is not correct. How do I incorporate error handling in
this code while using a Hlookup which I expect to fail given the underlying
data in the array that the Hlookup anlyazes?

On Error Resume Next
NumExists = Application.WorksheetFunction.HLookup(RowNumberArr ay(X),
NumberSetArray, 2, False)
If Not IsError(NumExists) Then
Do Something
End if

Thanks

EM


"ExcelMonkey" wrote:

I am thinking along the lines of something like this:

NumExists = Application.WorksheetFunction.HLookup(RowNumberArr ay(X),
NumberSetArray, 2, False)
If Not IsError(NumExists) Then
Do Something
End if
Not sure if I need an On Error/Resume stmt to make this work.

EM

"ExcelMonkey" wrote:

Yes. I am looking up a value in an array that is getting bigger after each
successive loop. There will be instances where the value is in fact not in
the array. I think I need to wrap some error handling around it so that if
it fails it does not stop the code.

EM

"Niek Otten" wrote:

I get this if the value to be looked up isn't present.

Do you really mean to look up the 7 itself?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ExcelMonkey" wrote in message ...
| Can't get this to work. I am trying to look up a value in the first
| dimension of an array called NumberSetArray. Keep getting the "Unable to get
| the Hlookup property" error.
|
| ?Application.WorksheetFunction.HLookup(7, NumberSetArray, 1, False)
|
| I know the array has a 7 in it first dimension as seen below.
| ?NumberSetArray(0,0)
| 7
|
|
| Is the problem due to the third term in the Hlookup Function?
|
| Thanks
|
| EM
|
|





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default "Unable to get the Hlookup property" VBA

Maybe this is my problem. My array is set up with 2 rows and multiple
columns. I am using a hlookup maybe I should be using a vlookup. Will look
into it

"ExcelMonkey" wrote:

Here is the dilemma. The Hlookup should at time find no value. However when
this happens the code fails stating Unable to get the Hlookup property. I
put an On Error stmt in do that the code would still loop. The hope being
that the IsErorr function would still pick up the error even thoughe code is
looping. However, the IsError stmt is always TRUE indicating there is never
an error which I know is not correct. How do I incorporate error handling in
this code while using a Hlookup which I expect to fail given the underlying
data in the array that the Hlookup anlyazes?

On Error Resume Next
NumExists = Application.WorksheetFunction.HLookup(RowNumberArr ay(X),
NumberSetArray, 2, False)
If Not IsError(NumExists) Then
Do Something
End if

Thanks

EM


"ExcelMonkey" wrote:

I am thinking along the lines of something like this:

NumExists = Application.WorksheetFunction.HLookup(RowNumberArr ay(X),
NumberSetArray, 2, False)
If Not IsError(NumExists) Then
Do Something
End if
Not sure if I need an On Error/Resume stmt to make this work.

EM

"ExcelMonkey" wrote:

Yes. I am looking up a value in an array that is getting bigger after each
successive loop. There will be instances where the value is in fact not in
the array. I think I need to wrap some error handling around it so that if
it fails it does not stop the code.

EM

"Niek Otten" wrote:

I get this if the value to be looked up isn't present.

Do you really mean to look up the 7 itself?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ExcelMonkey" wrote in message ...
| Can't get this to work. I am trying to look up a value in the first
| dimension of an array called NumberSetArray. Keep getting the "Unable to get
| the Hlookup property" error.
|
| ?Application.WorksheetFunction.HLookup(7, NumberSetArray, 1, False)
|
| I know the array has a 7 in it first dimension as seen below.
| ?NumberSetArray(0,0)
| 7
|
|
| Is the problem due to the third term in the Hlookup Function?
|
| Thanks
|
| EM
|
|



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
"Unable to get Pivot Tables Property of Worksheet Class "Error [email protected] Excel Programming 2 April 30th 07 06:18 PM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
Interop - "Unable to set the Color property of the Interior class" Elsa Excel Programming 2 August 23rd 06 04:57 AM
"Unable to set the Formula property of the Series class" with a tw PeterQ Charts and Charting in Excel 1 February 15th 06 07:37 PM
"Unable to get the Pivotfieldsd property of the Pivot Class" twaccess[_21_] Excel Programming 1 July 8th 05 01:42 PM


All times are GMT +1. The time now is 07:46 PM.

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"