+ Reply to Thread
Results 1 to 12 of 12

Macro that checks a list, and gives user prompt for action

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Macro that checks a list, and gives user prompt for action

    Hello Everyone!

    I have used this site in the past and found the advice very helpful so I thought I would register. To the point where I am now starting to take on some bigger excel VBA challanges, actually.

    I have provided a link to download an example workbook... this one is a huge challange and I'm not even sure where to start!

    On the example workbook there is a base data table, it describes the movement of items through "phases". To track this progress I use another table, which is actually in a different spreadsheet altogether but on the example it is shown on the table tab.


    The basic idea is that an item arrives, at phase 1. It either passes through phases 2 and 3 in order, or goes straight from phase 1 to 3 before going to phase 4 which is date stamped. At that point, the item would disappear from the data table as that one doesn't show phase 4. At each step the quantity may change slightly (the reduction or addition is random).

    So here is the challenge; unlike in the example there are thousands of rows of data to be checked. The way i check that items are matching each other is to pivot table the Data and then manually go down the list and mark off any changes on the second table.

    I have included pretty much all of the possible movements in the example book. (1-3,1-2,new arrival to phase 1,item 5 is showing that half of the quantity has been moved to phase 4 (with a date stamp sample, there are thousands of items to check each day - comparing the pivot table with the table tab and making changes to the quantities by overtyping the cells. So, what i would like to do is make a macro that would do many things really, i suppose the first step would be for someone to get me started by telling me if it's even possible.

    A macro would:

    - Check off items and quantites with no change, perhaps turning the text on the table tab a certain colour once it has successfully matched.

    - Bring up a dialog box of some sort (I do actually have an example as a userform in the example workbook). The dialog box would be asking the user to confirm the action that is needed for each item that has moved, according to which phase it's moving from. In every case, the action for the selection would be just to confirm that the quantity is to move to the reported phase column.

    * I would like the dialog box readout (or whatever the best solution ends up being), to display the query as, for example, "Item 1 moves from Phase 1 to Phase 2, quantity +200"
    To which the user would either click confirm and the table is adjusted to reflect that move, or cancels and the row is highlighted for review later.

    * In the case of a move to phase 4, would the macro be able to use the date stamp and assign a kind of rule of "if the date stamp = yesterday then make the change without asking, otherwise ask"?

    OK, i hope i haven't scared everyone away as this, to me, is massively ambitious. I'm going to be keeping an eye on this thread myself while i work on the problem so i'm looking forward to being told that "it's crazy, but it's crazy enough to work"!

    If I haven't been super clear, please don't hesitate to ask for clarity.




    http://www.mediafire.com/download/2c...Challenge.xlsm
    Last edited by jayherring86; 08-23-2013 at 05:07 AM. Reason: Spelling errors and an errant copy and paste due to slippery mouse

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Macro that checks a list, and gives user prompt for action

    The things you would like the macro to do seems very feasible, and rather simple to achieve. But the question is, how is the data being compared?

    Is the data in "Data" worksheet the 'current state' of the data and in "Table" worksheet are the upcoming updates needed to be done/applied for the list of items?

    Edit:
    Another question, for Item 5, it has 100 under phase 3 in "Data" worksheet, and has 100 under both phase 3 and 4 in "Table" worksheet. You mentioned it's because half of it is being moved to phase 4? How do you determine that 'half' ?
    Last edited by millz; 08-23-2013 at 05:34 AM.

  3. #3
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro that checks a list, and gives user prompt for action

    Thanks for the reply.

    The Data tab is the latest update and I use the pivot table to update the Table tab information on a daily basis. The table tab serves as a historical record of when items moved to phase 4, so has thousands of rows, hundreds of which do not show any item with quantities anywhere other than phase 4. Hundreds of others show no change from one day to the next and that's the part that seems the easiest to program for; simply look for the item number, check the quantity is the same, in the same column and turn the text say, blue.

    Where it gets complicated for me is when thinking about the items that have changed phase, they usually have a +/- 200 variance in quantity and of course, move from one column to another. I haven't ever tried populating a dialog box with anything other than a simple list of cell lookups.

    It gives me hope that you say things like this are feasible.

  4. #4
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro that checks a list, and gives user prompt for action

    Quote Originally Posted by millz View Post
    Edit:
    Another question, for Item 5, it has 100 under phase 3 in "Data" worksheet, and has 100 under both phase 3 and 4 in "Table" worksheet. You mentioned it's because half of it is being moved to phase 4? How do you determine that 'half' ?
    For some items, I may choose to move all, or just some of the quantity to phase 4 on a given date. Item 5 is an example of a time when i might choose to move only part of the total amount. As you can see the data table cannot see what is at phase 4 and is requesting that the information be updated from 200 at phase 3 to only 100 at phase 3.

    (In macro terms, I think the easiest way to do it would be to have the code look for a quantity in phase 4 and then check to see if the date is relevant - the only time it is relevant is when the date is "yesterday"). The macro can then see that this is the reason for the reduction, and after applying an acceptable variance (say P3+P4 +/-200) would make the change without prompt

  5. #5
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Macro that checks a list, and gives user prompt for action

    I don't really understand the purpose of the pivot table, which seems to be summing the values (qty in this case) for each phase. Am I right to say that whatever appears in "Data" tab should be updated/appended into "Table" tab?

    Edit for Item 5 again: I do not see any 200 being shown, where is it?

  6. #6
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro that checks a list, and gives user prompt for action

    Quote Originally Posted by millz View Post
    I don't really understand the purpose of the pivot table, which seems to be summing the values (qty in this case) for each phase. Am I right to say that whatever appears in "Data" tab should be updated/appended into "Table" tab?

    Edit for Item 5 again: I do not see any 200 being shown, where is it?
    The only sole purpose of the pivot table is to provide a printable form for me to have in front of me, when updating the Table tab. (These two tabs are in reality, on differenct workbooks.


    Item 5 would have shown on the Data table as 200 on the 21/august. 100 of it got moved to phase 4 on the 22nd august so the update for the data tab shows only 100 left as it can't see phase 4. Sorry that part isn't clear, i hope i cleared that up.

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Macro that checks a list, and gives user prompt for action

    Hi jay, sorry was having a busy weekend. Are you able to provide a more 'filled' sample file, preferably with 20 or more rows that requires updates, and only show what is needed for the macro. And preferably with a 3rd worksheet that shows the results of the updated table. Right now I'm still semi guessing what the macro should do

  8. #8
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro that checks a list, and gives user prompt for action

    Thanks for finding the time to help me out even though you are busy.

    I can certainly provide an expanded example, though it will have to be tomorrow when I can get back to my computer. I can't edit excel files on iPhone.

    I will elaborate on what the whole thing is here though, basically the data table is my simulation of a stock sheet from a warehouse. Each day I need to take their latest update of what movements they did with the stock, moving through the 3 phases they handle (phases are things like repackaging the items Etc.) my sheet, represented by the first tab in the example workbook I posted, needs to basically match their daily update with one or two differences. 1, I need to keep previous items on record to view back later, the data they send me doesn't keep a record once the item has left their warehouse. 2. My sheet has a phase that theirs doesn't. Phase 4 is actually my column for showing which items I want them to deliver to me, on which date, so theirs has no record of phase 4 because at that stage the items have left their warehouse.

    The daily inventory of what is at the warehouse and what isn't, including the phase changes and the new intakes is currently taking over an hour by hand, I think a macro could take this down to minutes by checking off the say, 90% of items that don't change phase, then giving the user an itemised report and asking to confirm any changes that it has noticed.

    Eg 1 list giving information about new intakes "item 7 has been added to phase 1"
    1 list giving details on phase changes like "item 5 100units has been moved from phase 1 to phase 3, new quantity 250.
    And another list reporting "item 2 100 units has been removed from phase 3"

    I'm wanting to either get a confirmation button for each individual item, or some way to select which changes to make, click confirm and then highlight the ones not changed in some way.

    In the case of anything but a removal from phase 3, there may be investigated needed, say new quantity is too low or something, but the phase 3 is much simpler really, it either has been moved out of the warehouse in full, or part of it has. In every case of this, phase 3 changes just need to be checked to see if there is a valid move date.

    I hope this makes the workings clearer, I will post an elaborated example tomorrow

  9. #9
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro that checks a list, and gives user prompt for action

    I have uploaded an expanded example sheet. The link is below (though i think the original link in the first post will also take you to the bigger example.

    The new workbook has a data tab for day 1, a table for day 1 and then a data tab for day 2 to show the progress through each update. I have included a tab with an explanation and details of all updates that are being made. This is about the closest thing i can provide to actually being the sheet i use (for data protection i can't show you the original, and besides, it's a 120mb behemoth).

    Any more questions let me know, I will start to work on my own code at some point tomorrow and i'll share it as i go.

    http://www.mediafire.com/?2c1zzndxc5x16v1

  10. #10
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Macro that checks a list, and gives user prompt for action

    How do you determine a unique line? e.g. Rows 41 and 42 are both Customer Three and Item code are both 23. It's like almost impossible to programmatically differentiate them.
    Unless you apply a logic like,
    1) this item code appears more than once
    2) for each of the appearance, check if the respective customer has a matching qty, if yes, that line is ignored
    3) if no, display every appearance (that are not previously/already ignored) and some human intervention will be required to determine which is the line that should be used/updated

    It may sound very feasible to be done, but would be quite complicated to be done through programming, and will still require human decision to continue.

    Another easy way would be, if you have and is able to add a unique document number, like a sales order number, purchase order, or a transfer/delivery order etc. to each row.

  11. #11
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Macro that checks a list, and gives user prompt for action

    It would be complicated to add another identifier to the database. I have thought about this kind of thing before so I'm glad you are thinking about things like that.

    Maybe the answer here lies in simplifying the system a little. The only reason that there would be two item 23's is that at some point I have tried to split the two quantities for a phase 4 movement. So, if I simply remove any doubling up like this, would that help?

    The only instances where item 23 would be on more than one row would be when some of it has moved to phase 4 already and wouldn't appear on the data updates.

  12. #12
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Macro that checks a list, and gives user prompt for action

    Quote Originally Posted by jayherring86 View Post
    Maybe the answer here lies in simplifying the system a little
    I don't really get what you mean by simplifying the system. If you can make sure that in both Data and Table Tab, each Customer number + Item code combination only appears once, then it would be much easier to code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Spelling errors-a macro to prompt user if a word is similar to a list and replace it
    By limebaish in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-27-2013, 04:26 PM
  2. [SOLVED] list of prompt action commands
    By slxia1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2012, 03:52 AM
  3. Replies: 0
    Last Post: 12-14-2011, 02:28 PM
  4. Dropdown List selection action checks cell value
    By new_excel_uesr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2011, 08:44 PM
  5. User prompt -> Open file -> Perform action
    By erikhs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2006, 08:55 AM

Tags for this Thread

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