I want to use my calculated values in a different sheet to do some more calculations

  • Hi guys,

    This is my 1st using this forum so I'm sorry if I'm missing some houserules.


    I made an hour registration form in visual basic with different types need to be calculated(preperation, production, packing, error and standing still)

    so the format for the textboxes is 00:00 to fill in time.

    To calculate the total time I seperated the hour and minutes with macros and they show up on the right of my table like this:

    So now comes the tricky part: everytime I fill in my hours I also fill in the unique identifier that belongs to the project.

    So I want to add an dropdown function and when I select YES I want the macro to get all the rows with the same unique identifier and calculate the total of hours and minutes spent on that number.

    I understand this is a lot but the biggest problem is that I don't know where to begin... how do I get the cells from above into variabeles I can do some fun stuff with?

    I'm lost


    Greetings,

    Fenna from the Netherlands xo

  • Hello and Welcome to the Forum :)


    To make everything much easier ... for everyone ... why don't you attach a sample file ...;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post


    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.


    How to use code tags

    Note: no apostrophe in the tags, just used for demonstration here.

    ['code]


    your code goes between these tags


    ['/code]


    Or, just highlight all of the code and press the <> in the post menu above button to add the code tags.


    Thanks.

  • Thanks for your Like :thumbup:


    Even a simplified version of your file... with obviously no confidential data ...( or fake data ) ...


    would help visualize your problem and suggest a practical solution :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • So here's my sample file.

    As you can see the values from my first post are on the right of de sheet database. I put some comments in module, you don't really have to do anything I just hope you understand what i need and can maybe point me in the right direction with some good sources that explain my problem very easily or something.


    is it possible to obtain all values(or some) of the rows of which has the same name?(aanvraagnr)

    and then before printing those variables in a different worksheet I want to sum all the hours and minutes together in a total of every aanvraagNr.

  • Hello,


    Thanks for your sample file ...


    Could you focus on a single row to illustrate your expected result ?


    Say, you look at cell D18 which shows 02:30:00 .... what should appear in all your 11 Columns , from S to AC ...


    even if you add the results manually ... at least it will demonstrate your goal ...;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • By the way ... have you tried in your macro to replace "u:mm" ... by the standard "hh:mm" ...???


    Just noticed your Columns D,E,F,F and H are formatted properly and =SUM(D18:H18) does produce ... may be ... your expected result ?

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • what is the difference to change it to hh:mm?


    the rows from S to AC are not that important, i just created that to seperate hour and minute. i want calculates on the different sheet "Totaal" so if i take D18 as example the aanvraagNR 2021-101, there is like 20 more rows with the same aanvraagNR. i want all the values from Voorbereiding as a sum in the worksheet totaal B2