I'm still getting an error as follows:
Runtime error '-2147352571 (80020005)
Could not set the value property. Type mismatch
I have two sheets in the workbook Invoices and Payments
ComboBox2 contains a supplier name selected from a list of Invoices
(recorded on sheet 1)
Textbox4 contains an Invoice Number which is selected by using a textbox
with an associated spinner
The spinup and spindown events cycle through the invoices for the supplier
Each spinner event is supposed to display the sum of all payments made
against the invoice (recorded on sheet 2)
see code below
In desperation I have formated the cells containing the invoice number as
both Text and Number on both sheets without having any effect on the error
Any help would be appreciated
............................................
Private Sub SpinButton1_SpinDown()
With Sheets("Invoices")
Set C = .Range("a:a").FindNext(C)
If C.Address = FirstAddress Then
Set C = .Range("a:a").FindPrevious(C)
LastAddress = C.Address
MsgBox "Last Invoice for " & ComboBox2
End If
TextBox4 = .Cells(C.Row, 3)
TextBox5 = .Cells(C.Row, 4)
With Sheets("Payments")
'next line gives error
TextBox11 = Evaluate("SUM(IF(((A1:A10)=" & ComboBox2.Value &
")*((B1:B10)=" & TextBox4.Text & "),D1
10))")
End With
End With
End Sub