+ Reply to Thread
Results 1 to 10 of 10

Using For Function

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    Monterrey,Mexico
    MS-Off Ver
    Excel 2003
    Posts
    38

    Using For Function

    Hello,

    I´m trying to build an inventory form where once i click a capture button, it subtracts or adds to an inventory table. Im having trouble figuring out how to use the for function.. here`s the code and a brief explanation of where i know i`m failing but having figured out. Please pardon my writing if it sucks, I`m mexican.

    Here is what i pretend to achieve with this button
    1) subtract or add to an inventory list, depending if im receiving a product or releasing one..
    Therefore i have ,per say ,4 comboboxes with the product listing to pick, and 4 other comboboxes on the side to select the quantity of each product i select. The first problem arises when I only select one product, the 2nd combobox product list is left empty. As you will see in my code, im always looking for the combobox list in a list i have in my worksheet and then subtracting or adding depending the case. When my code is running and i only pick 1 product rather than 2,3,4 or 5 possibilites i have on my userbox, i get an error because it tries to make an operation with no values.. I hope I explained myself ok.. Im very new with VB so sorry if i suck.

    2)The 2nd part of my code tries to carry this history to another worksheet. ( was working fine but now it`s not

    3)next I want to clear the user form but ,I`m not getting that, I was yesterday but don`t know what happened.

    4) I`m also trying to carry the history to 2 different sheets by using a multipage in my userform. one page for arriving parts , and another for leaving parts.. any advice on how to do this?


    Here`s the code.

    Please Login or Register  to view this content.
    Last edited by dmartinez; 07-16-2010 at 01:58 PM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Using For Function

    Please wrap your code in code tags, before the moderators get you...

    Forum rules
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button.

    Cheers

  3. #3
    Registered User
    Join Date
    07-07-2010
    Location
    Monterrey,Mexico
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Using For Function

    lol. thanks so much first time.. any ideas regarding my other problem?

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Using For Function

    This is difficult without the userform and workbook

    Try this
    Please Login or Register  to view this content.
    If this works, we can thin it out a bit more later
    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Using For Function

    The idea of Code tags is to make the code stand out & help us copy it, colouring it blue defeats the object!makes it useless to copy to the VB Editor
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    07-07-2010
    Location
    Monterrey,Mexico
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Using For Function

    SCRX.xls

    Here`s the file.

    Thanks for the code. The part where the inventory subtracts or adds items in the form is working find.. In sheet 3 I`m supposed to get the history, every time i press the capture button, im supposed to get automatically the fields on sheet 3 per form.. Also the form is not getting cleared after i press the button.. There are some textboxes ì`m not using yet.. Can you help me out getting the history and clearing the form? And also if you have any other suggestions would be deeply appreciated.



    thanks.

  7. #7
    Registered User
    Join Date
    07-07-2010
    Location
    Monterrey,Mexico
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Using For Function

    The history is working fine now. There`s a part in the code where I wanted to make sure the fields where filled before allowing the capture button work but the exit sub on the if`s was not allowing the next part , which is the historic part to work.. I still want to make sure the fields are filled with the propper data, but no idea how..

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Using For Function

    Use the forum facilities to attach a file.

    FAQs
    How do I attach a file to a post?

    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'. To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'. Clicking this button will open a new window for uploading attachments. You can upload an attachment either from your computer or from another URL by using the appropriate box on this page. Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file. To upload a file from another URL, enter the full URL for the file in the second box on this page. Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window. You can then close the window to return to the new post screen.
    Last edited by Marcol; 07-17-2010 at 12:46 PM.

  9. #9
    Registered User
    Join Date
    07-07-2010
    Location
    Monterrey,Mexico
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Using For Function

    Im also getting an error on this line, when i fill up more than 1 article.

    Please Login or Register  to view this content.
    Last edited by dmartinez; 07-18-2010 at 04:33 AM.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Using For Function

    Right,last warning about code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1