ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA SumIF (https://www.excelbanter.com/excel-programming/328427-vba-sumif.html)

Jennifer

VBA SumIF
 
Can I just say I am truelly learning Excel is never ending! This project
started rather modest. Ha!

Ok- I have a userform it displays an invoice # via cbobox. How do I have a
label on the form that looks at that invoice # goes to the producedata
worksheeet and does a sumif of the boxes sold. Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer

Bob Phillips[_7_]

VBA SumIF
 
Hi Jennifer,

Basic SUMIF in VBA is

myVal = Application.sumif(range("A1:A10"),"a",range("b1:b1 0"))

Then yoiu just replace tyhe test value for the combo value

myVal = Application.sumif(range("A1:A10"),cboInvoice.Value , range("b1:b10"))

You then might want to test there are no errors

If IsError(myVal) Then
MsgBox "error"
End If


--
HTH

Bob Phillips

"Jennifer" wrote in message
...
Can I just say I am truelly learning Excel is never ending! This project
started rather modest. Ha!

Ok- I have a userform it displays an invoice # via cbobox. How do I have a
label on the form that looks at that invoice # goes to the producedata
worksheeet and does a sumif of the boxes sold. Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer




Toppers

VBA SumIF
 
Hi,

=sumif(RngInvoices, InvoiceNo, RngBoxesSold)

Where RngInvoices is the range containing your invoice numbers
InvoiceNo is the Invoice # selected
RngBoxesSold is the range contain the boxes sold

e.g. =Sumif($a$2:$a$1000,InvoicNo,$D$2:$d$1000)

HTH

"Jennifer" wrote:

Can I just say I am truelly learning Excel is never ending! This project
started rather modest. Ha!

Ok- I have a userform it displays an invoice # via cbobox. How do I have a
label on the form that looks at that invoice # goes to the producedata
worksheeet and does a sumif of the boxes sold. Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer



All times are GMT +1. The time now is 10:15 AM.

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