ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Functions (https://www.excelbanter.com/excel-programming/372038-worksheet-functions.html)

alistre

Worksheet Functions
 
I am trying to codify Excel's Match function in VBA. Somewhere I have
a syntax error. I cannot figure it out. I am just learning about the
"Application.WorksheetFunction" syntax. Can you help me with writing
the Match argument?

Range("A10") =
Application.WorksheetFunction.Match(Range("L8").Te xt,Range("A1:A550"),0)


Norman Jones

Worksheet Functions
 
Hi Alistre,

Try:

Dim Res As Variant

Res = Application. _
Match(Range("L8").Value, Range("A1:A550"), 0)
Range("A10").Value = Res


---
Regards,
Norman


"alistre" wrote in message
oups.com...
I am trying to codify Excel's Match function in VBA. Somewhere I have
a syntax error. I cannot figure it out. I am just learning about the
"Application.WorksheetFunction" syntax. Can you help me with writing
the Match argument?

Range("A10") =
Application.WorksheetFunction.Match(Range("L8").Te xt,Range("A1:A550"),0)




alistre

Worksheet Functions
 
Thanks a lot. That worked perfect. I'm curious why the
"Application.WorksheetFunction" part was shortened to "Application".
Also, although the code worked, VBA didn't seem to recognize that
"Match" could follow "Application" when I tried to use Complete Word.
Do you know either answer? Thanks again.

Norman Jones wrote:
Hi Alistre,

Try:

Dim Res As Variant

Res = Application. _
Match(Range("L8").Value, Range("A1:A550"), 0)
Range("A10").Value = Res


---
Regards,
Norman


"alistre" wrote in message
oups.com...
I am trying to codify Excel's Match function in VBA. Somewhere I have
a syntax error. I cannot figure it out. I am just learning about the
"Application.WorksheetFunction" syntax. Can you help me with writing
the Match argument?

Range("A10") =
Application.WorksheetFunction.Match(Range("L8").Te xt,Range("A1:A550"),0)



Norman Jones

Worksheet Functions
 
Hi Alistre,

See:

http://tinyurl.com/o7lpe

or perform a google groups search using Ttappale error and WorksheetFuntion
as keys.


---
Regards,
Norman



"alistre" wrote in message
ups.com...
Thanks a lot. That worked perfect. I'm curious why the
"Application.WorksheetFunction" part was shortened to "Application".
Also, although the code worked, VBA didn't seem to recognize that
"Match" could follow "Application" when I tried to use Complete Word.
Do you know either answer? Thanks again.




Norman Jones

Worksheet Functions
 
Hi Alistre,

or perform a google groups search using Ttappale error and
WorksheetFuntion
as keys.


Turning on the light while I type:

or perform a google groups search using 'Trappable error' and
'WorksheetFuntion'
as keys.



---
Regards,
Norman



Norman Jones

Worksheet Functions
 
Hi Alistre,

See also Tom Ogilvy's response in your 'Using Excel functions in VBA'
thread.



---
Regards,
Norman




All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com