Hello there,
I'm new with macro's and this forum has help me and teach me a lot.
But now I'm unable to find a solution to the following issue.
For the below case I'm getting Run Type Error 13 and if remove .SpecialCells(xlCellTypeVisible) part, it will "work" but will also sum the hidden cells.
I will appreciate all the help I can get on this.
Many thanks :)
I'm new with macro's and this forum has help me and teach me a lot.
But now I'm unable to find a solution to the following issue.
For the below case I'm getting Run Type Error 13 and if remove .SpecialCells(xlCellTypeVisible) part, it will "work" but will also sum the hidden cells.
I will appreciate all the help I can get on this.
Code:
Private Sub CommandButton1_Click()
Dim srch As String
Dim EURsumact As Double
Dim USDsumact As Double
srch = Me.txtClientAcr.Value
AutoFilterMode = False
Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=srch
Selection.AutoFilter Field:=4, Criteria1:="Trust"
EURsumact = Application.SumIf(Range("C:C").SpecialCells(xlCellTypeVisible), "EUR", Range("D:D")) * 1.3
USDsumact = Application.SumIf(Range("C:C").SpecialCells(xlCellTypeVisible), "USD", Range("D:D"))
Me.txtTrustOut.Value = EURsumact + USDsumact
'test
MsgBox srch & " EUR=" & EURsumact & " + USD=" & USDsumact
Selection.AutoFilter
End Sub