Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Trying to get worksheefunction match to work

Hello,

I have this:

Dim MatchResponse as Variant
Dim PasteRow as Long
Dim nCount as Long

MatchResponse = Application.Match(Range(PasteRow, 1), _
Range(Cells(-nCount, 3), Cells(-nCount, 29)), 0)

The active cell is at (PasteRow,2).

The values in the local window a
PasteRow = 16
nCount = 15

I am trying to then use this to do an IsError(MatchResponse) but I keep
getting a runtime error ('1004' application-defined or object-defined error)
at this statement.

I have been trying to get this to work for sometime but have reached the end
of by beginners abilities. If someone could offer assistance, it would be
appreciated.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Trying to get worksheefunction match to work

VBA will catch the fact that the row number is negative and won't even run
the instruction. You probably want to put an error in a cell by dividing by
zero or fail a lookup() with N/A.

"NigelVII" wrote:

Hello,

I have this:

Dim MatchResponse as Variant
Dim PasteRow as Long
Dim nCount as Long

MatchResponse = Application.Match(Range(PasteRow, 1), _
Range(Cells(-nCount, 3), Cells(-nCount, 29)), 0)

The active cell is at (PasteRow,2).

The values in the local window a
PasteRow = 16
nCount = 15

I am trying to then use this to do an IsError(MatchResponse) but I keep
getting a runtime error ('1004' application-defined or object-defined error)
at this statement.

I have been trying to get this to work for sometime but have reached the end
of by beginners abilities. If someone could offer assistance, it would be
appreciated.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Trying to get worksheefunction match to work

Thank you Joel!

I am going to change the -ncount to a positive row reference rather than a
negative offset. I'll see how that works.

Otherwise - should how I have the ranges defined work?

Thanks again.





"Joel" wrote:

VBA will catch the fact that the row number is negative and won't even run
the instruction. You probably want to put an error in a cell by dividing by
zero or fail a lookup() with N/A.

"NigelVII" wrote:

Hello,

I have this:

Dim MatchResponse as Variant
Dim PasteRow as Long
Dim nCount as Long

MatchResponse = Application.Match(Range(PasteRow, 1), _
Range(Cells(-nCount, 3), Cells(-nCount, 29)), 0)

The active cell is at (PasteRow,2).

The values in the local window a
PasteRow = 16
nCount = 15

I am trying to then use this to do an IsError(MatchResponse) but I keep
getting a runtime error ('1004' application-defined or object-defined error)
at this statement.

I have been trying to get this to work for sometime but have reached the end
of by beginners abilities. If someone could offer assistance, it would be
appreciated.

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Trying to get worksheefunction match to work

Removing -ncount with a positive row reference did not work.

I get another runtime error - 1004 Method 'Range' of object' - Global' failed

Back to the drawing board. . .

"NigelVII" wrote:

Thank you Joel!

I am going to change the -ncount to a positive row reference rather than a
negative offset. I'll see how that works.

Otherwise - should how I have the ranges defined work?

Thanks again.





"Joel" wrote:

VBA will catch the fact that the row number is negative and won't even run
the instruction. You probably want to put an error in a cell by dividing by
zero or fail a lookup() with N/A.

"NigelVII" wrote:

Hello,

I have this:

Dim MatchResponse as Variant
Dim PasteRow as Long
Dim nCount as Long

MatchResponse = Application.Match(Range(PasteRow, 1), _
Range(Cells(-nCount, 3), Cells(-nCount, 29)), 0)

The active cell is at (PasteRow,2).

The values in the local window a
PasteRow = 16
nCount = 15

I am trying to then use this to do an IsError(MatchResponse) but I keep
getting a runtime error ('1004' application-defined or object-defined error)
at this statement.

I have been trying to get this to work for sometime but have reached the end
of by beginners abilities. If someone could offer assistance, it would be
appreciated.

Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Trying to get worksheefunction match to work

Okay changed the first range definition (what I am trying to match).

The final statement looks like this and works for my purposes.

MatchResponse = Application.Match(Range("A" & PasteRow), Range(Cells(x, 3),
Cells(x, 29)), 0)

Can't say I understand why one range def worked and the other didn't, but
hey this works and I can move on.

My apologies for learning while doing on the forum, but sometimes it helps
to get the brain nudged in a different direction. . .

And I thank Joel again for his nudging!




"NigelVII" wrote:

Removing -ncount with a positive row reference did not work.

I get another runtime error - 1004 Method 'Range' of object' - Global' failed

Back to the drawing board. . .

"NigelVII" wrote:

Thank you Joel!

I am going to change the -ncount to a positive row reference rather than a
negative offset. I'll see how that works.

Otherwise - should how I have the ranges defined work?

Thanks again.





"Joel" wrote:

VBA will catch the fact that the row number is negative and won't even run
the instruction. You probably want to put an error in a cell by dividing by
zero or fail a lookup() with N/A.

"NigelVII" wrote:

Hello,

I have this:

Dim MatchResponse as Variant
Dim PasteRow as Long
Dim nCount as Long

MatchResponse = Application.Match(Range(PasteRow, 1), _
Range(Cells(-nCount, 3), Cells(-nCount, 29)), 0)

The active cell is at (PasteRow,2).

The values in the local window a
PasteRow = 16
nCount = 15

I am trying to then use this to do an IsError(MatchResponse) but I keep
getting a runtime error ('1004' application-defined or object-defined error)
at this statement.

I have been trying to get this to work for sometime but have reached the end
of by beginners abilities. If someone could offer assistance, it would be
appreciated.

Thanks!



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
Index & Match doesn't seem to work BEEJAY Excel Worksheet Functions 2 November 17th 09 01:46 PM
Match doesn't work all the time? PaulW Excel Discussion (Misc queries) 6 December 1st 06 05:05 PM
MATCH does not work on a UDF-generated array pinkfloydfan Excel Programming 7 November 1st 06 12:50 PM
Hlookkup/Match won't work brianw Excel Worksheet Functions 4 September 25th 06 05:21 AM
Why doe this match nor work? cj21 Excel Discussion (Misc queries) 3 March 29th 06 02:18 PM


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