VBA Assistance

jstevens
GoldLounger
Posts: 2628
Joined: 26 Jan 2010, 16:31
Location: Southern California

VBA Assistance

Post by jstevens »

This bit of code works and returns the table record row. I'm trying to pass a variable to the invoice number but encounter an error 2029.

Code: Select all

FoundInvoice = Evaluate("=Match(7030, apTable[Invoice],0)")
Here is the code to pass a variable. I used a Dim Statement to declare the data type but that erred as well.

Code: Select all

Invoice = 7030
FoundInvoice = Evaluate("=Match(Invoice, apTable[Invoice],0)")
Regards,
John

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA Assistance

Post by HansV »

You have to place the variable outside the quotes and concatenate:

Code: Select all

Invoice = 7030
FoundInvoice = Evaluate("=Match(" & Invoice & ", apTable[Invoice],0)")
Best wishes,
Hans

jstevens
GoldLounger
Posts: 2628
Joined: 26 Jan 2010, 16:31
Location: Southern California

Re: VBA Assistance

Post by jstevens »

Thanks Hans!
Regards,
John