+ Reply to Thread
Results 1 to 14 of 14

Inventory Sheet updated continuously by a UserForm

  1. #1
    Registered User
    Join Date
    05-15-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Inventory Sheet updated continuously by a UserForm

    DISCUSSION

    I have a spreadsheet that I have been creating for work. It involves a UserForm (FRM_TubingTransfer) and writing the data entered onto sheets (either the ‘MASTER SHEET’ or ‘COMBOBOX DATA’) in the same workbook.

    PROBLEM

    I have (with your help and much trial and error) gotten the workbook to a reasonably working model. The only major thing left is the ‘AVAILABLE TUBING’ sheet. This sheet is the most complicated, I think, because it isn’t just strictly writing the data.

    First, any time there is a NEW PROPERTY / SUPERVISOR entered in the form onto the COMBOBOX DATA screen, the code needs to check the AVAILABLE TUBING sheet and check if that data has already been entered there (This is because there may be some instances where the PROPERTY NAME, and PROPERTY NUMBER are the same but have a different PROPERTY AFE. Aka, there may be two entries with ‘WELL 1’ that have different AFE numbers but they are the same location and need to be treated as such.). Also, if a pipe yard (denoted by “-YARD-“ in the Property number and AFE number column) is entered, do not enter it on the AVAILABLE TUBING SHEET.

    Second, when a TUBINGTRANSFER is processed, the program needs to do several things;

    For the FROM LOCATION (if a well and not a pipe yard)
    Add Buried Joints to the buried cell
    Add (E) to the damaged cell
    Subtract (A), (B), and (C) from the total on location cell
    For the TO LOCATION (if a well and not a pipe yard)
    Add (A), (B), and (C) from the total on location cell

    ANTICIPATED SOLUTION

    Some code to update the Property Location, Buried Joints, Damaged Joints, and Tubing on Location on the ‘AVAILABLE TUBING’ sheet.

    LINK TO PREVIOUS THREAD:

    http://www.excelforum.com/excel-prog...ml#post2105097
    Attached Files Attached Files
    Thank you for your time and help,

    Glenver McConnell

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Inventory Sheet updated continuously by a UserForm

    Hi Glenver,

    Take a look at the attached workbook and see what you think of it.

    The "AVAILABLE TUBING" has been altered so that it automatically picks up new locations as they are created. It also displays a the total number of joints available on each site - I haven't included any code to handle Damaged Joints, I think I need some more information from you on that one.

    If you're interested in learning about how VBA code should be structured, you could do worse than to take a look at how the various VBA modules are arranged.

    The "coupling" between worksheet-related and UserForm-related modules is just about as loose as it can be at this stage. UserForm code module contains absolutely no references to worksheets, columns, ranges, cells etc., and the standard VBA modules contain no references to textboxes, comboboxes, buttons etc.

    The standard VBA modules therefore "know" nothing about the layout of the UserForm or the contents of the UserForm VBA code module. All the UserForm VBA code module "knows" about the workbook and the standard VBA code modules is that there are a few functions and subroutines which it can call. Data are transferred between these modules as arguments of the functions/subroutines. This means that, among other things, if you want to change the names (or more importantly the types) of controls on the UserForm, all of the changes can be implemented within the VBA code module of the UserForm itself, with no need to make any "knock-on" changes in the standard VBA code modules. It also makes it very easy to use the same UserForm in another workbook which has a completely different arrangement for storing its data.

    Anyway, it's been an interesting exercise for me, and I hope it's been of some help to you also.

    Can you let me know what other aspects need to be added to the "AVAILABLE TUBING" worksheet?

    Regards,

    Greg M
    Attached Files Attached Files

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Inventory Sheet updated continuously by a UserForm

    Hi Glenver,

    I forgot to mention this in my last post.

    In one of your earlier posts you asked about using dynamic named ranges - the workbook I attached to my last post uses dynamic named ranges for all of the combobox dropdown lists except for the one used by the date combobox. I'm still trying to figure out why the calendar form won't work on your version!

    Regards,

    Greg M

  4. #4
    Registered User
    Join Date
    05-15-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Inventory Sheet updated continuously by a UserForm

    Greg,

    The code is looking more and more like something we could use every time, I thank you for taking so much time to help me create this program! I told the boss that we need to put you on the payroll!

    Anyways, the spreadsheet format is ideal, a couple things though. I would really love it if it didn't have any formulas in the cells and instead handled everything in a macro somewhere. I know that this works in the native excel you have set up as well but I won't be the person using this once it goes live and I don't really want a formula to show up missing at somepoint. This is going to be a continuous project for our office and if something gets messed at one stage, it will cause a ton of grief for everybody for each continuing entry, yaknow? I've heard rumors that a V.P. of another district got fired because he failed to keep track of his tubing as well as he should - which means me being a peon would go in a heartbeat! Because of this I would like to make this project as picture perfect as possible - something that other districts can pick up and use because it blows anything they have out of the water.

    A couple additional notes - when a new property is entered, the macro needs to search for and see if it has already been entered on the available tubing screen. This is because there may be an instance where the same well name and number are used with different AFE's. This is still the same location and should be treated as such on the available tubing sheet. Furthermore, I have included pipe 'yards' and pipe 'suppliers' to use the sheet. If something is denoted with "YARD" in the property number and AFE number then it should be treated as any other location. If it is denoted with "SUPPLIER" then it should not have an inventory associated with it (just the property info).

    Also, the damaged tubing information you requested - when a class 'E' box is filled out on the form, it needs to be added to the FROM LOCATION in the damaged tubing cell on the inventory sheet. When a class 'E' box is filled out on the TO LOCATION then it needs to be subtracted from the FROM LOCATION on the tubing transfer sheet.

    As for the calendar - when I tried to use it, I was on my personal computer at home logged on to a program called CITRIX to access my information on the network drive at work and I think that there was something going on with CITRIX that was messed up. I will try it again next time I'm in the office (I'm mostly in the field so that may be a while).

    Any more information please let me know.

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Inventory Sheet updated continuously by a UserForm

    Hi again Glenver,

    Glad to hear that you seem to like what you're seeing so far!

    I've got a question regarding the following which I really don't understand:

    Also, the damaged tubing information you requested - when a class 'E' box is filled out on the form, it needs to be added to the FROM LOCATION in the damaged tubing cell on the inventory sheet. When a class 'E' box is filled out on the TO LOCATION then it needs to be subtracted from the FROM LOCATION on the tubing transfer sheet.
    I thought that a Class E entry could relate only to a FROM LOCATION. As far as I can tell (but maybe I've misunderstood something), a form which contains a Class E entry is effectively two transfers, with the A, B and C entries going to the TO LOCATION, and the E entry going to the Junk Pile at the FROM LOCATION. As an example: There are 100 joints at Location A, 10 of these joints are damaged, and 20 "normal" joints are transferred to Location B. How do we record the situation at Location A after this transfer? Do we say there are 80 joints at Location A, 10 of which are damaged, or do we say there are 70 "normal" joints plus 10 damaged joints at Location A?

    Regarding the Calendar form, I've tested this workbook on my own PC (Windows XP plus excel 2000) and on my son's laptop (Windows XP plus Office 2007) and it works correctly on both machines. It would probably be a good idea to try it on one of your office pc's.

    Regards,

    Greg M

  6. #6
    Registered User
    Join Date
    05-15-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Inventory Sheet updated continuously by a UserForm

    Well, the class 'E' joints are a hassle for sure. They can't be transfered to other wells because accounting can't justify charging a cost to a well for pipe that we know is faulty. Also, my group can't justify paying a truck to pick up say one joint of tubing on a location every time we find a bad one.

    The compromise is to leave the tubing on location and once a month have a driver go to several locations to pick up this bad pipe.

    You are correct in thinking that 'E' tubing can only be charged to the FROM LOCATION. However, when we reconcile the pipe monthly, there needs to be another way to transfer from the location to the scrap yard. I'm thinking entering a negative number or a check box would be the easiest. Possibly a separate tab?

    Thoughts, ideas?

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Inventory Sheet updated continuously by a UserForm

    Hi Glenver,

    Okay on your last post. How about something like the following:
    We start by creating a new Location called "SCRAP" (possibly without an associated Property/AFE number? possibly "enterable" only in the TO LOCATION NAME combobox?)

    Now, Location A has 100 joints on site
    Location A receives a request to transfer 20 joints to Location B
    While preparing the joints for transfer, the supervisor at Location A notices that 5 joints in his stock are damaged.

    The supervisor at Location A prepares the transfer form for the 20 joints (A, B, C entries) and also records the fact that he's holding 5 damaged joints by entering 5 as an E entry.
    The AVAILABLE TUBING sheet processes this information and shows that, as far as Location A is concerned, there are now 75 "normal" joints on site plus 5 damaged joints.

    When the 5 damaged joints are eventually collected from Location A, the supervisor prepares a transfer form as usual, but specifies the TO LOCATION as "SCRAP".
    The AVAILABLE TUBING sheet processes this information and shows that the number of damaged joints at Location A has been reduced by 5, and the number of joints at SCRAP has increased by 5.
    Does the above approach sound like a possibility?

    Regards,

    Greg M

  8. #8
    Registered User
    Join Date
    05-15-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Inventory Sheet updated continuously by a UserForm

    Sounds good, so would the code have to do some sort of 'if going to scrap then this else act normal' deal?

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Inventory Sheet updated continuously by a UserForm

    Hi Glenver,

    I've been thinking a bit more about the damaged joints aspect, and have some suggestions to make.

    Let's forget about Excel for the moment and consider this as purely a paper-based process:
    (A) We have joints which we transfer in bulk between sites, and we use a transfer form to record each transfer process.

    (B) We have joints which arrive/become damaged on site and we wish to record this.

    Under normal conditions we would never consider using the paper transfer form associated with (A) to "make a note" of the fact that we also had damaged joints on site (B), but that's exactly what we're trying to do in the Excel version!

    I think we have to convert the "transfer plus note" operation into two separate "normal transfer" operations as follows:
    (1) When joints need to be transferred between locations they are recorded as Category A, B or C items, on a normal transfer form, as being sent from one location TO ANOTHER LOCATION - Operation (A).

    (2) When damaged joints are identified they are recorded as Category E items, on a normal transfer form, as being "sent" from one location TO THE SAME LOCATION - Operation (B). When this is done, the AVAILABLE TUBING sheet will display the fact that a certain number of joints at the location are damaged and are therefore not available for transfer to other locations, but will need to be removed from site for scrapping at some stage.

    The other operation we need to cater for is when we wish to remove damaged joints from site and transfer them in bulk to a scrapyard. In order to do this, when damaged joints need to be transferred to the scrapyard they are recorded as Category E items, on a normal transfer form, as being sent from one location TO SCRAP.


    Take a look at the attached workbook and see what you think.

    Regards,

    Greg M
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-15-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Inventory Sheet updated continuously by a UserForm

    Greg, I have been very busy lately and haven't had much time to look into your workbook but I will soon, thank you for your continued help!

  11. #11
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Inventory Sheet updated continuously by a UserForm

    Ok on that - keep me posted with whatever you need.

    Regards,

    Greg M

  12. #12
    Registered User
    Join Date
    05-15-2009
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Inventory Sheet updated continuously by a UserForm

    It's been a while, let's see if anybody remembers the problem...

    I'm still working on it and it would be nice for a couple things to happen when the drop-down boxes are selected that have the corresponding drop down boxes associated with them.

    First, would it be possible to have some sort of concatenation happen on the 'Property Name' drop down box? What I mean is, while the 'COMBOBOX DATA' sheet will still just list the well name as 'WELL ABC', could it read 'WELL ABC - AFE 123456' on the form? This is because there may be several AFE numbers associated with the same well and it would be necessary to differentiate between them.

    EDIT - Also, It would be cool if the SUPPLIER locations came up first, then the YARD locations, then the wells.

    Also, it would be nice if the property name box was alphabetical when the drop down arrow was engaged, and the property number and AFE number be numerical. So I'm saying, is it possible to sort each of these categories each time the drop down arrow is engaged?

    Any help will be as always, appreciated.

  13. #13
    Registered User
    Join Date
    07-18-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Inventory Sheet updated continuously by a UserForm

    I know it has been quite awhile since this thread has been active; however, I am building a similar spreadsheet for keeping track of pipe in a storage yard. I found this thread while doing some research. Does anyone know if this spreadsheet ever got completed to the way the original creator intended? I was hoping I could have a look at the end result to assist in the format of my similar version.

    Thanks,

    James
    Last edited by arlu1201; 04-03-2013 at 02:18 PM.

  14. #14
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Inventory Sheet updated continuously by a UserForm

    Its been 4 yrs since the question was posted and it is not likely that the original poster will come back.

    Why dont you post a new thread for your question? You may get faster replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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