+ Reply to Thread
Results 1 to 10 of 10

VBA for Input Boxes

  1. #1
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    VBA for Input Boxes

    Hello!

    I have a spreadsheet that adds retail stock to a master stock list. On the control sheet, the user inputs all the information (brand, name, colour etc.) and I have some vba code that allows the user to select multiple sizes from a drop-down list.

    When the user clicks submit, I would like an input box to appear for each size asking for the unique barcode (e.g if the user selected 'S, M, L' an input box should appear reading 'Please input barcode for size S' and then the same for size M and L). When finished, all the data will be copied over to master list.

    I think this may need to be done with an array, but I'm not too knowledgable on how arrays work...

    Hopefully, these images should help clarify the before and after intention. I have also attached my worksheet for reference.

    1. User inputs information

    Screenshot 2019-04-06 at 10.22.46.png

    2. Input boxes appear per size asking the user for the barcode

    Screenshot 2019-04-12 at 08.48.49.png > Screenshot 2019-04-12 at 08.49.10.png etc.

    3. After barcodes for all sizes are collected, data is moved to the master list

    Screenshot 2019-04-06 at 10.24.00.png


    I have some code already and I have left a comment where the input box vba should go;

    Please Login or Register  to view this content.
    I'm a vba novice so any help would be appreciated! Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA for Input Boxes

    Why an input box, you've got it on screen.
    You say you're a novice but you have this code, who helped you?
    I'm not a MAC user but can help but I think you should pick-up some knowledge, only asking will not solve it for when it comes to need to modify,
    A quick search with Google came up up with some links to start looking and learning
    https://powerspreadsheets.com/create-excel-userforms/
    https://analystcave.com/vba-userform...cel-userforms/
    https://www.tutorialspoint.com/vba/vba_userforms.htm
    https://www.homeandlearn.org/getting...ser_forms.html

    I'll check out your file and see if I can help, but I need a lot of info, what type of values in the textboxes? what characters are allowed? Are you entering these by hand or using a barcode scanner, etc etc.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA for Input Boxes

    Hi! Thank you for your reply.

    Why an input box, you've got it on screen.
    I'm not sure what you mean by this question? I could've added a barcode cell to the user form I already created but this would mean that the user could only enter one size at a time and would have to put in the same data over and over, which is why I'd like the user to be able to just put the data in once and then input boxes appear to enter the unique barcodes per size. Ultimately, this should save the user time.

    You say you're a novice but you have this code, who helped you?
    I've been able to teach myself a lot from these forums and various websites but there's a lot of trial and error involved so I wouldn't say I'm proficient at vba.

    I'm grateful for the links provided but I already know how to create an input box - I'm just not sure how to include it to get the results I want. The values will be purely numerical barcodes typed in by the user (no barcode scanner used).

    I'm guessing the code will need to;

    1. Use a Split function to decide how many input boxes will appear (e.g. if the size cell contains 'S, M, L' then 3 input boxes will appear in total - 1 for each size)
    2. Show the input boxes one after another (adapted for each size) and allow the user to add the barcodes
    3. Copy the data to the master list

    I'm certainly not expecting someone to just write everything for me, but any pointers in the right direction will certainly help me piece something together!

    Thanks

  4. #4
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA for Input Boxes

    Please ignore - ran the wrong code haha!
    Last edited by benjhardie; 04-12-2019 at 05:12 AM.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA for Input Boxes

    I think I'm getting the idea the 'user form' which is the worksheet Control you make your selections but then when you come to sizes you may have more than one to enter and you would like to enter a barcode for each size, correct?
    Does this also mean that a size can have a different cost and retail price too?
    What I am thinking is that the top three lines are common to the following 5 ines or will you also enter per colour?
    SKU is that a common value for the same size and colour or also different
    What I'm getting at is that once the common values are entered than you should get a userform to select all the possible combinations of the next 5, I would maybe do that all in ONE userform not a form sheet since every entry will be a separate line (record) in the stock sheet or will you have to include a search to append an existing stock item?

    You see once you start the exceptions add up and yes, starting with one leads to the next if you want it to be reliable.

  6. #6
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA for Input Boxes

    I've figured it out! Actually a lot simpler than I thought it'd be. I'm sure my code may be a bit clumsy though so would still appreciate any tips.

    Please Login or Register  to view this content.
    I've reattached my workbook so you can see what it does.

    Although, the only problem I have now is the values in Col. K in the Stock List aren't automatically calculating when data is added to the sheet from the code. However, they do update if I click in the cell in question and press enter. Do you know why this might be?

    I also need to put an error rule in in case someone presses cancel on the input box or puts in a non-numerical entry. Would you be able to advise me on the best way to do this?

    Thank you!
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA for Input Boxes

    Quote Originally Posted by Keebellah View Post
    I think I'm getting the idea the 'user form' which is the worksheet Control you make your selections but then when you come to sizes you may have more than one to enter and you would like to enter a barcode for each size, correct?
    You're exactly right. And all the values are common except size and barcode, so they won't have different prices etc.

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA for Input Boxes

    Don't use InputBox but Application.InputBox, you can add the type of entry allowed, Type 1 or 2 is only numbers

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA for Input Boxes

    Suggestion, after you have submitted, insteead of clearing all, ask if youw ant to enter another size and just clear the size cell

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA for Input Boxes

    Try this, Application.Inputbox implemented
    Attached Files Attached Files

+ 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. Looking for help with input boxes
    By cluelessnomad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2014, 01:18 PM
  2. Additional input Boxes, based on answer to first input box
    By DrBball7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 05:38 AM
  3. [SOLVED] User Input Boxes
    By downhilsheep in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2012, 09:55 AM
  4. Input boxes
    By nitrox_guy in forum Excel General
    Replies: 1
    Last Post: 04-27-2011, 10:26 AM
  5. Input boxes
    By luke_p in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2008, 09:12 AM
  6. Input boxes
    By gav_69 in forum Excel General
    Replies: 6
    Last Post: 09-05-2008, 07:12 AM
  7. Input Boxes
    By Danielle88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2008, 11:56 PM
  8. Replies: 1
    Last Post: 11-09-2005, 06:40 PM

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