Bob Phillips,
Thank you for the reply!
I still need alittle help with this though. Could you walk me through
this example?
Would it be like this?
Private Sub Commandbutton1_Click()
IncDec txt1Add, True
IncDec txt1Subtract, False
IncDec txt2Add, True
IncDec txt2Subtract, False
IncDec txt3Add, True
IncDec txt3Subtract, False
etc... until all 14 textboxes are written here?
****the IncDec txt1 refers to the textfields correct?**** So, if
have 14 fields, I'll have 28 lines here in this part?
End Sub
Private Sub IncDec(textbox As msforms.textbox, Increment As Boolean)
Dim iItem As Long
iItem = Evaluate("Match(" & textbox.Text & ", A1:A10, 0)")
If iItem 0 Then
If Increment Then
Cells(iItem, "B").Value = Cells(iItem, "B").Value + 1
Else
Cells(iItem, "B").Value = Cells(iItem, "B").Value - 1
End If
End If
End Sub
****In this part would I do the following as an example?*****
iItem=Evaluate("Match(" &textbox1.Text & ", B3, 0)")
if iItem 0 Then
if Increment Then
Cells(iItem, "B4").Value = Cells(item, "B4").Value +1
Else
Cells(item, "B4").Value = Cells(item, "B4").Value -1
End If
End If
End Sub
My 1001.01 is located in Cell B3 on the spreedsheet. And the amoun
that I want to add to and subtract from is in Cell B4. So, when I typ
in the number 1001.01 in the textbox on the userform, the number i
Cell B4 will increase.
Here's another question:
If textbox1 through textbox7 are under the ADD column on the userfor
and textbox8 through 14 are under the SUBTRACT column, how would tha
be written above? would it be like the following?
partial example
Private Sub IncDec(textbox As msforms.textbox, Increment As Boolean)
Dim iItem As Long
iItem = Evaluate("Match(" & textbox1.Text & ", B3, 0)")
If iItem 0 Then
If Increment Then
Cells(iItem, "B4").Value = Cells(iItem, "B4").Value + 1
Else
Cells(iItem, "B4").Value = Cells(iItem, "B4").Value - 1
End If
End If
iItem = Evaluate(Match(" & textbox1.Text & ", C3, 0)")
if iItem 0 Then
Cells(item, "C4").Value = Cells(iItem, " C4").Value +1
Else
Cells(iItem, "C4").Value = Cells(item, "C4").Value -1
End If
End If
End Sub
On my spreedsheet(classdb1) I have the following(small example):
1001.01 is in cell B3 and #amount(let's say 10) is in Cell B4.
1001.02 is in cell C3 and #amount(23) is in Cell C4
1001.03 is in cell D3 and #amount (8) is in Cell D4
Bob, please post back and tell me if this is correct or not and if yo
can, correct the example and then I'll start typing it up. I'
thinking that this is going to get big.
Thank you,
marty
--
Message posted from
http://www.ExcelForum.com