Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Variable in function problem

So h is a string?

How about:

"=""" & h & """))"))
or
"=" & chr(34) & h & chr(34) & "))"))

to wrap it with quotation marks.



JAVB wrote:

I have the following function in my code.

h = "06180J435448"
intClmCterTotal = CLng(Evaluate("=SUMPRODUCT(--(" & _
Range("Sum_Report_Name").Address(True, True, xlA1, True) & _
"=""HITNOIJ ""), --(" & Range("Sum_Claim_Number").Address(True, True,
xlA1, True) & _
"=" & h & "))"))

The value returned is 2015 which I believe is an error code
(Application-defined or object-defined error).

When I change the variable h to a hard coded claim number, the code
returns 12 which is the correct answer.
intClmCterTotal = CLng(Evaluate("=SUMPRODUCT(--(" & _
Range("Sum_Report_Name").Address(True, True, xlA1, True) & _
"=""HITNOIJ ""), --(" & Range("Sum_Claim_Number").Address(True, True,
xlA1, True) & _
"=""06180J435448""))"))

I need to have the claim number as a variable so I can look up
different claims and apply the rest of the code to them.

What am I doing wrong? Any help would be appreciated.

--
JAVB
------------------------------------------------------------------------
JAVB's Profile: http://www.excelforum.com/member.php...o&userid=29304
View this thread: http://www.excelforum.com/showthread...hreadid=559019


--

Dave Peterson
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
Variable Problem. Tim Excel Programming 4 January 23rd 06 04:10 PM
Having a problem using a variable to add a 'name' Kobayashi[_50_] Excel Programming 1 October 29th 04 03:20 PM
Variable problem TC[_6_] Excel Programming 3 September 16th 04 09:39 PM
vba variable problem joao Excel Programming 3 December 15th 03 04:31 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


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