+ Reply to Thread
Results 1 to 29 of 29

Vba code for my userform

  1. #1
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Vba code for my userform

    Hi Good evening..

    I need VBA code for my userform.

    Pls help me to make it active and the template attached here for your kind reference.
    Attached Files Attached Files

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Huh? I see no userform in your workbook, and you have not explained anything about what the code should do...
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    My file in .xtlm extension and not able to attach it.

    Pls find the below link to do the needful.


    https://www.dropbox.com/s/8pnxe3v4sh...FORM.xltm?dl=0


    It is a inventory related userform and make it active by your valuable code.

  4. #4
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi,

    Pls see the screen shot fyr
    Attached Images Attached Images

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    The dropbox link doesn't work... however, if you save as .xlsm instead, then you can attach it... it would still allow me to see what the form is like. I also need to understand what you want the code to do.

  6. #6
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    The attached excel with a user-form going to use for inventory management in a Stationary shop.

    I need the right codes for,

    1. INWARD (user-form name)

    --> The filling data need to update in "INWARD ENTRY" sheet in the excel.

    2. OUTWARD

    --> The filling data need to update in "OUTWARD ENTRY" sheet in the excel.

    3. ADD PRODUCT

    --> The filling data need to update in "PRODUCT LIST" sheet in the excel.


    Also,

    1. All "DATE" text box must fill automatically current date
    2. The combo box drop down as per the combo box label name marked in the "PRODUCT LIST"

    Hope you understand what i am expecting and if any additional information to workout this, pls ask me..

    you are really great for learned this VBA codes...

    tks

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Ramesh... I still don't have a file from you with userforms in it... as mentioned the xlsx has no forms in it, and the dropbox link does not work.

  8. #8
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi sorry..

    Now i have attached with some updation in my userform.
    Attached Files Attached Files

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    You say "update"... Ok, but what does update mean? Just add new row after last entry? Or does it have to add quantity if all other values match an existing row?

    Also, you have pages and quantity on your Add Product userform, but the Product List sheet has no "quantity" column?
    Last edited by Arkadi; 07-21-2017 at 07:28 AM.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    In the spirit of helping, without doing all the work for you, here is code for the "ADDPRODUCT" form... it should probably be enough to help you make code for the other forms, feel free to ask questions if you need help

    Please Login or Register  to view this content.
    Last edited by Arkadi; 07-21-2017 at 08:06 AM. Reason: OP indicated he didn't need one of the textboxes.

  11. #11
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Quote Originally Posted by Arkadi View Post
    You say "update"... Ok, but what does update mean? Just add new row after last entry? Or does it have to add quantity if all other values match an existing row?

    Also, you have pages and quantity on your Add Product userform, but the Product List sheet has no "quantity" column?
    oh... sorry...
    The "ADD PRODUCT" user-form should not consist of quantity and i will remove it tks

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Ok, I will change my code in last post to ignore the quantity text box... you can then try it out.

  13. #13
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    I am happy that, you are observing me what actually i am expecting, and even i am beginner of VBA.

    I will come back to you, once i tried your golden codes, powered my UF.

  14. #14
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    The codes are awesome... and somewhat i can understand the codes to try other 2 UF's by my own.

    Also pls clear some few of missing features below,
    1. Once the opening of "ADD PRODUCT" UF, the cursor s/b in the first text box (brand name) instead of last text box as of now.
    2. Once all data's filled and click "CONFIRM" button, i expect to get a msg box to ensure the data's added in the "PRODUCT LIST" and then, the entered data's immediately clear and stay blank.
    3. I have "Product code" column in "product list" sheet for naming a code for every individual products. So when i add a product, the product code column will auto fill the next code number of its previous row product code number.
    4. Also add product UF should not allow me to add same product again.

    Hope your beautiful code will decorate my UF....

    tks in advance...

  15. #15
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Ramesh, about your request for other fixes:

    1. Go to the form, select the brand name box, and in the properties window, set the TabIndex to 1. This will make it the first texbox to be active... then make product name 2, and so on... this will control the order the boxes are active when the user hits tab.
    2. Fixed with the new code below.
    3. Fixed with the new code below.
    4. Fixed with the new code below.

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    Its really awesome...

    Perfectly working my UF..

    Its really powered by you thanks....

    I follow your code and create the other UF by own.

  17. #17
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Ok Ramesh, thanks for the feedback, and good luck
    If you have any problems please feel free to ask for help dealing with them

  18. #18
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    I have workout the product "INWARD" UF as per your way of codes.
    See my post #6 to recall..

    The Inward UF contains,
    8 combo boxes named as seller_name_combobox, brand_name_combobox, product_name_combobox, description_name_combobox, size_combobox, color_combobox, pages_combobox, unit_combobox

    I linked the each combo box with the right source (drop down list in excel sheet)

    2 text boxes named as date_textbox, quantity_textbox

    1 list box named as "Listbox1"

    Now i need your help here,

    Except "seller_name_combobox" If we select the item in other combo boxes as one by one, The list box should display the related product codes as below,
    If we select a seller name in seller_name_combobox the list box show empty
    If we select a brand in brand_name_combobox the list box need to show all product codes which having this selected brand
    If we select a product in product_name_combobox, the list box need to show all the product codes which having only the selected product & brand name
    As like finally, if we select a item in pages_combobox, the list box need to show only one product code which is perfectly match to the all selected items in combo box.
    Why should I required this feature is,
    If we know the product code, when I am selecting the items in combo boxes,
    Directly we will select the product code in the list box, if we select a product code from List box, then, the concerned product details should auto fill as per the product code.
    Now I have attached my UF excel here for your kind reference to do the needful.
    Advance thanks for keep on helping to my project.
    Attached Files Attached Files

  19. #19
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Why does the listbox need to be empty when seller name is entered? Is it just because that is the first step?
    You should remember that users don't always behave as we expect when making code... so it is possible the will choose Product Name, then Colour, then Unit, then Seller Name, then Brand name... etc.

    Here is what I was thinking is maybe a good solution. For each ComboBox (except seller name of course), put a change event in the code:

    Please Login or Register  to view this content.
    and then each change will cause this code to run (put in userform also):

    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    Your codes are really amazing...

    The same products will be supply from more then one seller and you know that, we have not considered the seller name in product code.

    If the list box getting fill by seller name selection, it will shows the unrelated products codes compare to the product which we are trying to inward.

    If i am trying to inward a "pen" from a seller, and the same seller supplying me "scale","pencil","marker" etc..

    The list box will shows also the "Pen","Scale","pencil","Marker" product code numbers... And i think its unwanted...

    Also pls provide the code for, if i select a product code from list box, the concerned product description will auto fill the combo boxes.

    Thanks a lot in advance to make me happy by improving my project by your valuable codes..

  21. #21
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    One more is there for ask to you,

    My excel having "stock" work sheet and i have put formula as Inward qty - Outward qty to arrive the stock quantity.

    While i am trying to outward a quantity of particular product code material in "OUTWARD" UF, and the product code material stock quantity is less then the outward quantity, i need a msg box with warning and show the stock quantity, if i click the confirm button in the "OUTWARD" UF.

    Even you know all information regarding my project, i will attach my UF for your kind reference.
    Attached Files Attached Files

  22. #22
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Quote Originally Posted by Ramesh h&m View Post
    Hi Arkadi,

    Your codes are really amazing...

    The same products will be supply from more then one seller and you know that, we have not considered the seller name in product code.

    If the list box getting fill by seller name selection, it will shows the unrelated products codes compare to the product which we are trying to inward.

    If i am trying to inward a "pen" from a seller, and the same seller supplying me "scale","pencil","marker" etc..

    The list box will shows also the "Pen","Scale","pencil","Marker" product code numbers... And i think its unwanted...

    Also pls provide the code for, if i select a product code from list box, the concerned product description will auto fill the combo boxes.

    Thanks a lot in advance to make me happy by improving my project by your valuable codes..
    For the userform, I was getting the product codes from the PRODUCT LIST sheet because I thought that was the master list of possible products... but if that does not have seller, and you want to include seller as criteria for which codes to show in the listbox for the inward entry form then we need to change that...
    The problem is, I think you will first create a product in product list, before you can enter it in "inward entry", so the problem is that not all products will be in the inward entry list... so we can't really filter the codes by Seller Name?

    Also, for auto-fill of the combo boxes when a listbox item is selected.... what sheet do you want the information to come from? Product List, or Inward Entry
    Last edited by Arkadi; 07-28-2017 at 07:54 AM.

  23. #23
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    you
    For the userform, I was getting the product codes from the PRODUCT LIST sheet because I thought that was the master list of possible products...

    Me
    Yes of-course..

    you
    but if that does not have seller, and you want to include seller as criteria for which codes to show in the listbox for the inward entry form then we need to change that...

    Me
    Actually i don't need product codes in the List box based on seller name as a criteria
    So what i explained in my previous post, as this is unwanted.

    You
    The problem is, I think you will first create a product in product list, before you can enter it in "inward entry", so the problem is that not all products will be in the inward entry list... so we can't really filter the codes by Seller Name?

    Me

    You are correct.. My plan is to add all the products in the "product list" and named by a product code before it will get inward.
    I think you misunderstood my words...

    Actually What i wrote in my previous post for first 4 lines is, the answer for your question "Why does the listbox need to be empty when seller name is entered?"
    I just explained the dis-advantages, if the list box get filtered on seller name selection...
    Hope now you are clear...

    You
    Alco, for auto-fill of the combo boxes when a listbox item is selected.... what sheet do you want the information to come from? Product List, or Inward Entry

    Me
    I will explain that...

    "INWARD" Userform opened,

    If i select "TNPL" in the "brand_name_combobox"
    The list box will show prodct codes "A0001 & A0002"

    If i know the product, i am trying to inward is "A0001" than, i will just click on the product code (A0001)

    Now the "Product_name_combobox" auto fill with "A4 sheet" from the product list.
    Also the "Description_combobox" auto fill with "GSM" from the product list.
    Than "Size_combobox" auto fill with "70" from the product list.
    Than "Color_combobox" auto fill with "NA" from the product list.
    Than "pages_combobox" auto fill with "500" from the product list.

    Just i need to fill the "Quantity_textbox" and "Unit_combobox" manually and get confirm to inward the product.

    Hope the information is clear to help me.

  24. #24
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi..

    I think that, i am taking most of your working time for my query...

    I am really sorry for that...

    Because, I am get interested on UF's & so that i have start digging the VBA codes, even i have not learned.

    Thanks a lot for your continuous support....

  25. #25
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Try this for your INWARD form:

    Please Login or Register  to view this content.

  26. #26
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    Wow its working perfectly...

    Your codes are really great and i feel this like a magic to working in the UF...

    Also pls advise that,

    1. I am trying to protect my "product list" & "Inward entry" sheets by below code,

    Please Login or Register  to view this content.
    I don't know where to add this code to make it possible.

    2. When i am selecting item in each combo boxes in "Inward" UF, system get loading for few seconds between the selections. I think the system taking time to work for drop down list.
    hence i think to ask, Is it possible to fetch the source data from product list for the combo boxes? Instead to fetching the source data from drop down list, created separately.
    Kindly provide your valuable codes and thanks in advance...

  27. #27
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vba code for my userform

    Any module that makes changes to the sheets will have to unprotect the sheet at the start somewhere, and then at the end protect again. Keep in mind that if any sections inside the code use "Exit Sub" then the program ends there, so it won't get to the bottom. So you may have to add the protect in a few places. Also, remove the "=" from the command, it is:

    Please Login or Register  to view this content.
    2. The delay is because the program that filters your product codes to match the comboboxes, is performing the autofilter on the Product List sheet. You could use an array to load all the products in the product list and use that to find the product codes that match... I will look into that if I have some free time today or tomorrow.
    Last edited by Arkadi; 07-31-2017 at 07:45 AM.

  28. #28
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    Thanks to you, supporting for my project, and expecting the same till my project end.

    Hope you may allot few time for me, soon.. for giving your golden codes..

    Also,

    1. I have an issue that, the inward date format changed from 01/08/2017 (dd/mm/yyyy) entries. I have double check the format cells and also copy the format from the date 31/07/2017. Still i am facing this issue, pls advise..

    2. When i am click the command button "INWARD" / "OUTWARD" / "ADD PRODUCT", i need to minimize the workbook automatically. Can you pls help on this...

    tks

  29. #29
    Forum Contributor
    Join Date
    03-28-2016
    Location
    india
    MS-Off Ver
    2013 (in 2023)
    Posts
    124

    Re: Vba code for my userform

    Hi Arkadi,

    Pls help me to finish my project and thanks in advance...

+ 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. How to change the code inside a userform by using another userform
    By king05 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2017, 02:10 PM
  2. Replies: 2
    Last Post: 05-24-2016, 05:27 AM
  3. VBA code to lock textbox in a userform which was unloaded to from another userform
    By Pimp_mentality in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2016, 12:20 AM
  4. Re-code Userform to open range of sheets like previous sheet code
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2014, 02:31 AM
  5. Exit Userform to return to main code, but keep userform open
    By jombler74 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-04-2014, 04:01 AM
  6. UserForm help - display list of open workbooks except workbook userform code is in
    By kensweep in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-09-2014, 12:26 PM
  7. [SOLVED] Userform code fails when the userform is called from a custom ribbon button
    By klonbeck in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2013, 03:00 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