SumIf in vba returns 0 value in userform

djemy1975

New Member
Joined
Jan 18, 2016
Messages
28
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:

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,065
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,326
Messages
5,595,519
Members
413,996
Latest member
mabelO

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
Top