View Single Post
  #10   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 posted this in response to your other question

Private Sub CommandButton1_Click()
IncDec txt1Add, True
IncDec txt1Subtract, False
IncDec txt2Add, True
IncDec txt2Subtract, False
IncDec txt3Add, True
IncDec txt3Subtract, False
IncDec txt4Add, True
IncDec txt4Subtract, False
IncDec txt5Add, True
IncDec txt5Subtract, False
IncDec txt6Add, True
IncDec txt6Subtract, False
IncDec txt7Add, True
IncDec txt7Subtract, False
End Sub

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

On Error GoTo incdec_exit
iItem = Evaluate("Match(" & textbox.Text & ",A1:H1, 0)")
If iItem Then
If Increment Then
Cells(2, iItem).Value = Cells(2, iItem).Value + 1
Else
Cells(2, iItem).Value = Cells(2, iItem).Value - 1
End If
End If
incdec_exit:
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,

I had a little progress today. Here's what I've got so far:

Private Sub CommandButton1_click()

IncDec Txt1Add, True
IncDec Txt2Add, True
IncDec Txt3Subtract, True
IncDec Txt4Subtract, True
End Sub


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

iItem = Evaluate("Match(" & Txt1Add.Text = "1001.01" & ",B1 +1, 0)")
If iItem 0 Then
If Increment Then
Cells(1, iItem).Value = Cells(1, iItem).Value + 1
End If
End If
iItem = Evaluate("Match(" & Txt2Add.Text = "1001.01" & ",1, 0)")
If iItem 0 Then
If Increment Then
Cells(1, iItem).Value = Cells(1, iItem).Value + 1
End If
End If
iItem = Evaluate("Match(" & Txt3Subtract = "1001.01" & "1, 0)")
If iItem 0 Then
If Increment Then
Cells(1, iItem).Value = Cells(1, iItem).Value - 1
End If
End If
iItem = Evaluate("Match(" & Txt4Subtract = "1001.01" & ", 1, 0)")
If iItem 0 Then
If Increment Then
Cells(1, iItem).Value = Cells(1, iItem).Value - 1
End If
End If

End Sub



Private Sub CommandButton3_Click()
End
End Sub

_______________________________________________

So far, I did get rid of some of the errors. If you noticed that there
is "1001.01". For some reason the debugging program was asking for
this. I find this interesting. Other than that the userform still
does not work.

Can we start over? I'm getting alittle lost at this point. I spent 5
hrs yesterday trying to figure it out.

Here's what I have in this arrangement. If you could, could you follow
it in your excel program and see what you come up with as a possible
solution:

Column A
In cell A1 is 1001.01
In cell A2 is 1001.02

Column B
In cell B1 is 10
In cell B2 is 10

Create a userform with 4 inputboxes(textboxes)
two boxes per column. The heading of the left column will be "Add" and
the heading for the right column is "subtract"
Name your userboxes: (1st one on the upper left as "txt1Add", 2nd one
on the bottom left is "txt2Add". 3rd one on the upper right is
"txt3Subtract", and finally "txt4Subtract" for the bottom right.

Then create two bottons on the bottom of the userform:
"Enter" and "Exit".

What I'm trying to obtain is the ability to type in the section number
"1001.01" in either txt1Add or txt2Add in order to increase the number
from 10 to 11. Also, trying just the opposite, typing in "1001.01" in
either txt3subtract or txt4subtract in order to go from 10 to 9. I'm
also trying to do this with any section number.

I guess I got overwhelmed and confused on this part of the process.

Any of your help is much appreciated

marty6


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