+ Reply to Thread
Results 1 to 10 of 10

Identify groups and calculate with VBA UserForm

  1. #1
    Registered User
    Join Date
    12-09-2021
    Location
    Melbourne
    MS-Off Ver
    365
    Posts
    7

    Identify groups and calculate with VBA UserForm

    Hi Everyone,

    Its my first time using VBA and any sort of coding in general so I have been cracking my head for weeks trying to do this UserForm . I'm wondering if there is anyone here that could help me with it? Any help is appreciated, Thank you in advance!!

    I've created a UserForm (Sheet 1 Button: Click me to enter Data ) to key in data into the excel spreadsheet. There is Name(cboName), Product(cboProduct), Date(txtDate) and Quantity(txtQuantity). I would like the last column ( Time Taken ( which is Quantity*standard time ) ) to be automatically calculated in the excel worksheet as the rows of data is added. The Data reference(Table3) for the standard time is in another sheet ( Sheet2 ) and to get the standard time, I would have to identify first from which group does the product lies, as the standard time is tied to the group. I am able to do it with excel formula ( IFS ) quite easily but I would like to do it with VBA so whoever uses it wouldn't accidentally delete or change the formula. Is there a way to do so? I'll attach the screenshot of the excel formula below.

    I have attached my Excel worksheet here, the IFS formula that I tried is also in the worksheet. Thanks!!

    I'm sorry I didn't know that I'm not allowed to post on other Forums, but I posted on 2 others Forums yesterday. I'll attach the links below. If this causes any inconvenience, do let me know so I can take down the thread in other Forums!
    Link 1 :"stackoverflow.com/questions/70285615/search-data-to-calculate-the-quantity-with-vba-userform"
    Link 2 :"mrexcel.com/board/threads/search-data-and-calculate-with-vba-userform.1189762/"

    *I removed the www and https because it seems like I wouldn't be able to upload with it
    Attached Files Attached Files
    Last edited by JustoneE; 12-09-2021 at 11:59 PM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Identify groups and calculate with VBA UserForm

    Hi Justin

    This will give you an idea...Your file had no Userform or any code so I had to improvise...
    I also changed your sheet setup...Ideally always start in [A1] of worksheets...
    To much code to post...

    The Exit Button just hides the Userform...Was for testing only...
    Attached Files Attached Files
    Last edited by sintek; 12-10-2021 at 04:02 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    12-09-2021
    Location
    Melbourne
    MS-Off Ver
    365
    Posts
    7

    Re: Identify groups and calculate with VBA UserForm

    Oh my! That is exactly what I wanted! I am so impressed that what took me weeks to do took you only so little time! May I know if there is any way to view your codes from your attachment so I can learn from it?
    Thank you again!!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Identify groups and calculate with VBA UserForm

    Press Alt F9 - takes you to Project Window
    Select Developer from Ribbon, press Visual Basic -takes you to Project Window

    PS - Forgot to clear TextBox4...Add red snippet
    Please Login or Register  to view this content.
    Last edited by sintek; 12-10-2021 at 04:44 AM.

  5. #5
    Registered User
    Join Date
    12-09-2021
    Location
    Melbourne
    MS-Off Ver
    365
    Posts
    7

    Re: Identify groups and calculate with VBA UserForm

    Thank you so much for your help!

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Identify groups and calculate with VBA UserForm

    With reference to your other post here

    The reconciliation of Stylists hours based on date...How often do you extract...Is it daily or monthly...Does the recon get cleared when new recon is wanted...
    Does your register get cleared every month or is it continuous...
    Is the stylist list for extraction based on your existing database or is it only those that have entries in register...

    From this other post you have a separate userform...I would make use of the same Userform...Just adding date selection and Stylist name and then doing extraction...

    PS...I noticed an error in code above

    remove red snippet...
    Please Login or Register  to view this content.
    Last edited by sintek; 12-10-2021 at 05:59 AM.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Identify groups and calculate with VBA UserForm

    Anyway...Here is an amended version with Time Extraction...
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-09-2021
    Location
    Melbourne
    MS-Off Ver
    365
    Posts
    7

    Re: Identify groups and calculate with VBA UserForm

    Thank you for the Time Extraction file!! I am sorry due to various reason I couldn't be on computer and hence the late reply. I have just tried on the Userform and I couldn't seem to let it calculate, Could you advice me on it?

    Replying to your previous reply, the hours that they do, I would like to calculate them daily, but per month on each sheet. For example, the sheet I am working on right now is for the month of December, I would have 2 tables in each Sheet and every time I key in the data with the Userform it will show on the first table and automatically calculate the time taken based on the date and the name stated on the next table. Then for the month of January, I would open a new sheet ( Sheet 2 ) and key in the data in the exact same way, so each sheet will be of different month and each month will be broken down to everyday of the month. So this excel goes on and on for the future months to come, with more and more sheets.
    The previous data for previous months will not be deleted and will be kept as reference.
    The will also be calculated based on a fixed table. The table would have Names on the X axis and All the dates of the month on the Y axis. If they do not have data to be calculated for that date, a "0" would be shown on the table.

    I hope this clears things up!

    I truly appreciate your help, it has been a great help for me.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Identify groups and calculate with VBA UserForm

    JustoneE

    May I ask why you would want to separate the register into Months when all you can do is extract any required data via your Userform Interface...
    I would have 1 Register Tab & 1 Extraction Tab - With headings Jan - Dec...When extracting, it extracts to required Month...One could also just extract monthly data for your Monthly Chart...1 Tab for the 12 charts...
    At year end I would make a copy of Register Tab ... name it Register 2021 and clear Register Tab for new year...

    Anyway...just my two cents...If you prefer to go your route then I suggest you setup your file in your required layout...This is going to take alot of coding so you might have to do it in different steps with different threads...

    I have just tried on the Userform and I couldn't seem to let it calculate, Could you advice me on it?
    The file in above post 7 had some data already captured...On userform at bottom you are able to
    Select Month...in this case Dec
    Select Stylist...On this selection, the total time for month is shown in Total Time box

    Untitled.png
    Last edited by sintek; 12-14-2021 at 03:58 AM.

  10. #10
    Registered User
    Join Date
    12-09-2021
    Location
    Melbourne
    MS-Off Ver
    365
    Posts
    7

    Re: Identify groups and calculate with VBA UserForm

    Thank you for the suggestion! I totally understand where you are coming from! I'm not very good with excel so I'm not sure if there are any hidden tools that might help me do so but, the reason I want to extract it by month is because every month after keying in the data I would have to do an overall performance graph for each day of the month, then individual performance graph of the month and the daily individual performance graph for every single person for that month.

    If it takes a lot of coding for the one I'm trying to do, I might not be able to work it out, so I really should try it the way you suggested first and see if I can work with the graph in another way.

    Thank you!! I'll try to work on it first now. And I'm open to all suggestion!

+ 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 identify a name in groups with the highest revenue.
    By FrancisM2411 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-14-2018, 02:58 AM
  2. [SOLVED] Identify the higest value and sum across groups
    By bunty_1244 in forum Excel General
    Replies: 15
    Last Post: 04-11-2017, 11:26 AM
  3. Looking for a VBA or method that will identify if groups of data contain a value
    By oxfordshire23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2017, 12:16 PM
  4. [SOLVED] Identify duplicate groups of cell in column
    By ids in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-24-2014, 09:33 AM
  5. Replies: 1
    Last Post: 09-02-2013, 06:27 AM
  6. [SOLVED] How to identify those names shared by two groups and do a sum-up?
    By zjianguk in forum Excel General
    Replies: 5
    Last Post: 03-14-2013, 12:53 PM
  7. identify earliest & latest date groups in table
    By Brontosaurus in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 07-19-2011, 04:26 PM

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