LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default Code Calculation Problem

I apologize in advance for re-posting this question. However, I haven't got
an answer to it yet and thought a fresh string might catch some "new" eyes.
I can't get the formula to calculate correctly. If I just put J1 in the
formula, it does fine. However, I don't want to put J1, I want to put var1.
This is vital to some significant programming I plan on doing, but have to
make it work on the small scale first. Please help!

Private Sub CommandButton1_Click()

Dim Ans1 As Range
Dim var1 As String
Dim WS As Worksheet

Set WS = Worksheets("Sheet1")
Set Ans1 = WS.Range("h2")
var1 = "J1"

Ans1.Value = Worksheets("sheet1").Evaluate("=SUMPRODUCT((A1:A10 ="" &
var1 & "")*(B1:B10=k1))")

End Sub


--
Thanks
Shawn
 
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
calculation problem Suleman[_2_] Excel Worksheet Functions 1 April 30th 08 11:37 PM
calculation problem Suleman[_2_] Excel Worksheet Functions 3 April 28th 08 04:11 AM
Calculation problem - please help Neil Hindry Excel Discussion (Misc queries) 2 July 10th 06 02:38 PM
conditional formatting vba code and calculation Jill[_7_] Excel Programming 1 May 25th 04 12:31 AM
Calculation Problem Derek[_2_] Excel Programming 4 September 24th 03 01:40 AM


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