View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Need help with userform....please....

Marty,

I think that was because I wasn't allowing for testing against a string. Are
B3, C3 string values? If so this is tested and should work

Private Sub CommandButton1_Click()

IncDec txt1Add, True
IncDec txt1Subtract, False
'etc.
IncDec txt14Add, True
IncDec txt14Subtract, False

End Sub

Private Sub IncDec(textbox As msforms.textbox, Increment As Boolean)
Dim iItem As Long

iItem = Evaluate("Match(""" & textbox.Text & """, B3:H3, 0)")
If iItem 0 Then
With Worksheets("Sheet1")
If Increment Then
.Cells(4, iItem + 1).Value = .Cells(4, iItem + 1).Value + 1
Else
.Cells(4, iItem + 1).Value = .Cells(4, iItem + 1).Value - 1
End If
End With
End If

End Sub

Private Sub UserForm_Click()

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"marty6 " wrote in message
...
Hi Bob,

When I ran the Debug, I got the following error:

compile error:
ByRef Argument type mismatch

What was highlighted in the window:

txt1Add




Thanks,

Marty6


---
Message posted from http://www.ExcelForum.com/