Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with vba coding/userform....

Hi guys,

Hate to post this again but I still need help on a vba userform.
Here's what I have so far thanks to Bob Phillips. :) I have modifie
the programming that he is helping me with. This is what I have s
far:


Private Sub CommandButton1_Click()
IncDec txt1Add, True
IncDec txt1Subtract, true
End Sub

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

iItem = Evaluate("Match(" & txt1Add.Text & ",A1, 0)")
If iItem Then
If Increment Then
Cells(2, 1).Value = Cells(2, 1).Value + 1
End If
End If
End Sub

Private Sub CommandButton2_Click()
End
End Sub

Private Sub UserForm_Click()

End Sub

______________________________________________

Here's part of my layout on my spreed sheet:

A1 has 1001.01
B1 has 1001.02
C1 has 1001.03

A2 has 10
B2 has 10
C2 has 10

What I'm trying to do is create a userform with inputboxes that wil
allow 1001.01(A1) to update 10(A2). The form has will have 7 boxe
under the word Add on the userform and 7 boxes under the word Subtract
I would like to be able to input 1001.01 in any of the add boxe
inorder to update A2. And also be able to type in 1001.02 in any o
the Add boxes and update only B2. These ("1001.01") type of number
represent section numbers and the 10 numbers or any number in colum
two will represent amounts. I could have all the section numbers i
column A and all the updatable quantity numbers in column B. Is ther
a way in order to this to work? Is there a way of using Match item i
column A and update corresponding cell in column b by "1". If
section number is enter in an inputbox on the userforum under th
subtract column, then the opposite effect would happen. Th
corresponding cell would decrease.

With this part of the program I modified:
iItem = Evaluate("Match(" & txt1Add.Text & ",A1, 0)")
If iItem Then
If Increment Then
Cells(2, 1).Value = Cells(2, 1).Value + 1

When I put "1001.01" in the txt1Add input box, the Cell A2 gets update
by 1.

I added the following, but got a debugging error:

iItem = Evaluate("Match(" & txt1subtract.text & ",A1, 0)")
If iItem Then
If Increment Then
Cells(2, 1).Value = Cells(2, 1).Value + 1

Is there a way to have it as such:

(for the add boxes)
List:
If 1001.01(A1) then add 1 to b1
If 1001.02(A2) then add 1 to b2
If 1001.03(A3) the add 1 to b3
ect...?

(for the subtract boxes)
List:
If 1001.01(A1) then subtract 1 from b1
etc....?

Any help is appreciated!

marty

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help with vba coding/userform....

Hi Marty,

I thought we had got further than this last week.

This should complete it.

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

Private Sub CommandButton2_Click()
End
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 guys,

Hate to post this again but I still need help on a vba userform.
Here's what I have so far thanks to Bob Phillips. :) I have modified
the programming that he is helping me with. This is what I have so
far:


Private Sub CommandButton1_Click()
IncDec txt1Add, True
IncDec txt1Subtract, true
End Sub

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

iItem = Evaluate("Match(" & txt1Add.Text & ",A1, 0)")
If iItem Then
If Increment Then
Cells(2, 1).Value = Cells(2, 1).Value + 1
End If
End If
End Sub

Private Sub CommandButton2_Click()
End
End Sub

Private Sub UserForm_Click()

End Sub

______________________________________________

Here's part of my layout on my spreed sheet:

A1 has 1001.01
B1 has 1001.02
C1 has 1001.03

A2 has 10
B2 has 10
C2 has 10

What I'm trying to do is create a userform with inputboxes that will
allow 1001.01(A1) to update 10(A2). The form has will have 7 boxes
under the word Add on the userform and 7 boxes under the word Subtract.
I would like to be able to input 1001.01 in any of the add boxes
inorder to update A2. And also be able to type in 1001.02 in any of
the Add boxes and update only B2. These ("1001.01") type of numbers
represent section numbers and the 10 numbers or any number in column
two will represent amounts. I could have all the section numbers in
column A and all the updatable quantity numbers in column B. Is there
a way in order to this to work? Is there a way of using Match item in
column A and update corresponding cell in column b by "1". If a
section number is enter in an inputbox on the userforum under the
subtract column, then the opposite effect would happen. The
corresponding cell would decrease.

With this part of the program I modified:
iItem = Evaluate("Match(" & txt1Add.Text & ",A1, 0)")
If iItem Then
If Increment Then
Cells(2, 1).Value = Cells(2, 1).Value + 1

When I put "1001.01" in the txt1Add input box, the Cell A2 gets updated
by 1.

I added the following, but got a debugging error:

iItem = Evaluate("Match(" & txt1subtract.text & ",A1, 0)")
If iItem Then
If Increment Then
Cells(2, 1).Value = Cells(2, 1).Value + 1

Is there a way to have it as such:

(for the add boxes)
List:
If 1001.01(A1) then add 1 to b1
If 1001.02(A2) then add 1 to b2
If 1001.03(A3) the add 1 to b3
ect...?

(for the subtract boxes)
List:
If 1001.01(A1) then subtract 1 from b1
etc....?

Any help is appreciated!

marty6


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help with vba coding/userform....

Marty,

The idea is right, but I think you need this code

Private Sub IncDec(textbox As msforms.textbox, Increment As Boolean)
Dim iItem As Long
On Error Resume Next
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
Else
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
End If
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
...
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 product
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....marty6


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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with vba coding/userform....

Bob,

Wonderful! Superb!....It's working. I'll keep you posted as to th
progress. I just got two more books on vba to further help in thi
process.

Thank you!

marty

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help with vba coding/userform....

Marty,

That's good. We'll keep an eye out.

--

HTH

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

"marty6 " wrote in message
...
Bob,

Wonderful! Superb!....It's working. I'll keep you posted as to the
progress. I just got two more books on vba to further help in this
process.

Thank you!

marty6


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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fix the coding? Eric Excel Worksheet Functions 4 June 20th 07 02:42 PM
Coding metaltecks Excel Discussion (Misc queries) 1 April 17th 06 10:12 PM
Userform inside another userform Ryan Excel Programming 0 April 23rd 04 08:01 PM
API coding Sheela Excel Programming 3 August 30th 03 02:17 AM
Help coding userform Bob Kilmer Excel Programming 0 July 11th 03 01:23 AM


All times are GMT +1. The time now is 09:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"