SumIf in vba returns 0 value in userform

djemy1975

Board Regular
Joined
Jan 18, 2016
Messages
51
Dear firends,

I have a userform "frmSuivi" in which I want to display some calculations ,among them count and sumif

I have set up the functions for those calculations but the result is "0".I think the problem is related to numbers format in the sheet ,knowing that the data is entered via another userform.I could not figure out how to get this problem over .

Could someone help me to go through.

the code is put in userform initialize
Code:
Private Sub UserForm_Initialize()


sn = Sheets("BDD").Cells(1).CurrentRegion
    For j = 1 To UBound(sn, 2)
        ListView10.ColumnHeaders.Add , , sn(1, j), 90
    Next
    For j = 2 To UBound(sn)
        With ListView10.ListItems.Add(, , sn(j, 1))
           For jj = 2 To UBound(sn, 2)
                .ListSubItems.Add , , sn(j, jj)
           Next
        End With
    Next
    ListView10_Click
 'Sum of paid invoices
Dim rB As Range
Dim dResult As Variant
Set rB = Worksheets("BDD").Range("G2:G1000")


dResult = Application.WorksheetFunction.SumIfs(rB.Offset(0, 4), rB, "Paid")

TextBox7 = dResult

end sub
Thanks in advance,
 
Last edited by a moderator:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I think you'll need to adjust the code in the other form that populates the cells. I suspect your data range cells are actually text and not numbers.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top