View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
marty6[_8_] marty6[_8_] is offline
external usenet poster
 
Posts: 1
Default Help with vba coding/userform....

Bob,

Is there a way to have a third and fourth line added for sequencing?

a1:h1 are the section numbers
a2:h2 are product numbers

Can I add a3:h3 as more product numbers and added a4:h4 as more produc
numbers and keep the same setup in the userform but add these lines?


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

Would it be something like this?


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
iItem = Evaluate("Match(" & textbox.Text & ",A3:H3, 0)")
If iItem Then
If Increment Then
Cells(4, iItem).Value = Cells(4, iItem).Value + 1
Else
Cells(4, iItem).Value = Cells(4, iItem).Value - 1
end if
end if
incdec_exit:
End Sub

Thank you again for your advice! It worked great!!:) :)

marty6

I tried this and had an error with the line:
iItem = Evaluate("Match(" & textbox.Text & ",A3:H3, 0)")
Your thoughts?

Thank you again....marty

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