+ Reply to Thread
Results 1 to 2 of 2

Eliminate similar IF statements?

  1. #1
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Eliminate similar IF statements?

    I have a userform which I use to track equipment repair history.

    The userform is comprised of the following items
    Textbox for RMA number: txtPORMA
    Textbox for PO number: txtPO
    Textboxes for Serial numbers: txtPOSerial1 - txtPOSerial14
    Textboxes for Cost on the PO: txtCost1 - txtCost14
    Textboxes for the reason of the repair: txtReason1 - txtReason14
    Checkboxes if the serial number will be added to the PO: chkPOSerial1 - chkPOSerial14
    Command Button to submit the changes: btnAddPO

    What happens is that a user puts in an RMA number and the form finds all the corresponding serial numbers that go with it which are stored on the spreadsheet. Not every serial number will be added to the PO because it might be covered under warranty. So here the user would check the checkbox if the serial number is going to be added to the PO. When they click the submit button it updates the PO number on the spreadsheet.

    I'm currently using the following code to find the RMA number, find the matching serial number, and then find if the user has checked the box and then add the po, cost and reason.

    Sometimes there may only be 1 serial number to an RMA but there could be as many as 14. Each serial number is stored on a separate line on the spreadsheet.

    Please Login or Register  to view this content.
    As you can see, whats in red is basically repeated 14 times, one for each serial number and check box box. I keep thinking there has to be a way to eliminate these similar If statements, I'm just not sure how.

    I do use this same method for other things on the userform so I'm hoping that if I can find a way to do it here, that I can use it in other places as well.

    Thank you!

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

    Re: Eliminate similar IF statements?

    It might be easier to see an example workbook
    Hope that helps.

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

    Free DataBaseForm example

+ 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