Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Variable used in a =SUMIF() function?

Hi,

How do I replace the "A40" parameter with the nLastrow varable below?

nLastrow = 100

objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF
(A4:A40,""'5734' "",B4:B40)"

I've been trying many things with double-double quotes but nothing
works.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Variable used in a =SUMIF() function?

On Sep 10, 1:30*pm, circuit_breaker
wrote:
Hi,

How do I replace the "A40" parameter with the nLastrow varable below?

* nLastrow = 100

* objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF
* (A4:A40,""'5734' "",B4:B40)"

I've been trying many things with double-double quotes but nothing
works.

Thanks.


This worked:

ActiveSheet.Range("D20").formula="=SUMIF(A4:A"&nRo w
&",""'5734'"",B4:B41)"
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Variable used in a =SUMIF() function?

I'm not sure what you're doing, but even though excel is forgiving, I'd want my
ranges to be the same size. And are you sure you want those single quotes
around that 5734?

Just in case you want to try it:

ActiveSheet.Range("D20").Formula _
= "=SUMIF(A4:A" & nRow & ",""5734"",B4:B" & nRow & ")"

circuit_breaker wrote:

On Sep 10, 1:30 pm, circuit_breaker
wrote:
Hi,

How do I replace the "A40" parameter with the nLastrow varable below?

nLastrow = 100

objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF
(A4:A40,""'5734' "",B4:B40)"

I've been trying many things with double-double quotes but nothing
works.

Thanks.


This worked:

ActiveSheet.Range("D20").formula="=SUMIF(A4:A"&nRo w
&",""'5734'"",B4:B41)"


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,420
Default Variable used in a =SUMIF() function?

objExcel.ActiveSheet.Range("D20").Formula = _
"=SUMIF(A4:A" & nLastRow & ",""'5734' "",B4:B" & nLastRow & ")"


--
__________________________________
HTH

Bob

"circuit_breaker" wrote in message
...
Hi,

How do I replace the "A40" parameter with the nLastrow varable below?

nLastrow = 100

objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF
(A4:A40,""'5734' "",B4:B40)"

I've been trying many things with double-double quotes but nothing
works.

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
Sumif based on two variable Memphus01 Excel Discussion (Misc queries) 4 December 10th 08 04:36 AM
SUMIF With Variable Consecutive Days Peanut Excel Worksheet Functions 6 May 10th 07 08:02 PM
SumIf for Variable Conditions JP Excel Worksheet Functions 6 November 13th 06 10:31 AM
how to use a variable for the criteria in a sumif function? Dick B. Excel Worksheet Functions 5 May 1st 06 12:55 PM
Sumif with variable target Brisbane Rob Excel Discussion (Misc queries) 2 March 23rd 06 11:20 AM


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