+ Reply to Thread
Results 1 to 14 of 14

calculate times from VBA and not directly from cells

  1. #1
    Registered User
    Join Date
    11-09-2019
    Location
    Milan, Italy
    MS-Off Ver
    office 365
    Posts
    64

    calculate times from VBA and not directly from cells

    Hello again (naturally... ),
    I have this sheet and in some cells I have a time calculting formula like this one:

    Please Login or Register  to view this content.
    I input the data in this sheet via a Userform. I would like to be able to calculate the times via vba and not via the formulas in the sheet.

    is it possible? if so... how?

    thank you for any help.

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

    Re: calculate times from VBA and not directly from cells

    Try this, it's easier then explaining

    http://mikevba.altervista.org/macro/mikevba108.php
    Buona fortuna
    ---
    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
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: calculate times from VBA and not directly from cells

    calculate the times as a variable and then you can assign it to any cell you want

    Please Login or Register  to view this content.
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  4. #4
    Registered User
    Join Date
    11-09-2019
    Location
    Milan, Italy
    MS-Off Ver
    office 365
    Posts
    64

    Re: calculate times from VBA and not directly from cells

    hello Saravnepali,

    I have tried implementing your solution but without much of a success. Below please find my code. Can you please tell me where to insert it?
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, Suffolk (England), but grew up in Sawley, Derbyshire
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2301 (Windows 11 22H2 64-bit)
    Posts
    65,650

    Re: calculate times from VBA and not directly from cells

    Attach your workbook - instructions in the yellow banner at the top of the page.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" to anyone who has offered you help in your thread. You can reward them by clicking on * Add Reputation below theur user name on the left, if you wish.


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  6. #6
    Registered User
    Join Date
    11-09-2019
    Location
    Milan, Italy
    MS-Off Ver
    office 365
    Posts
    64

    Re: calculate times from VBA and not directly from cells

    I have attached a file. "Flight Report" is where I need the formulas to appear. Right now the formulas are in the cells but I would like the sheet not to have any formulas in it, this to prevent errors.

    also... is it possible to have a code that no matter what somebody inserts in the userform's textbox1, 2, 4 and 5, what appears in "Flight Report" is alwasy hh:mm? so if somebody insert 0230 or 02.30 it will be 02:30
    Attached Files Attached Files

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

    Re: calculate times from VBA and not directly from cells

    I am sure that you have a computer screen that can manage the entire userform.
    What you need to do is force the correct time input in each userfom textbox where only time values are allowed.
    I see Landin and ATA but if you attach a screen shot with all the fields that require a time-input, I'll try my best to help you and also make sure that the userform zooms to fit any computer screen you use.

  8. #8
    Registered User
    Join Date
    11-09-2019
    Location
    Milan, Italy
    MS-Off Ver
    office 365
    Posts
    64

    Re: calculate times from VBA and not directly from cells

    Attachment 652288

    Hello "Howbeautiful" ... attached please find the screen shot.

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

    Re: calculate times from VBA and not directly from cells

    Attachment is not visible for me, invalid attachment, please attach files as indicated in the forum rules

  10. #10
    Registered User
    Join Date
    11-09-2019
    Location
    Milan, Italy
    MS-Off Ver
    office 365
    Posts
    64

    Re: calculate times from VBA and not directly from cells

    Attachment 652315

    it is strange, I have followed the instructions and I can see the attachment when I click on it...

    anyways... second try....

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

    Re: calculate times from VBA and not directly from cells

    Same problem. check for errors when attaching. but anyway, try this, hope it works as I think it should and that you can use it.
    Attached Files Attached Files

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

    Re: calculate times from VBA and not directly from cells

    Ciao Mauro,
    With your idea and question implemneted

    A domani.
    Hans
    Attached Files Attached Files

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

    Re: calculate times from VBA and not directly from cells

    The latest version, playing around with VBA and it's possibilities
    Attached Files Attached Files

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

    Re: calculate times from VBA and not directly from cells

    Same version number but more elaborated
    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. Replies: 7
    Last Post: 04-09-2014, 09:25 AM
  2. [SOLVED] calculate turn around times range of times for weekday and weekend
    By xrayexceller in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-28-2013, 02:22 PM
  3. A way to directly access favorite cells
    By Hanny304 in forum Excel General
    Replies: 7
    Last Post: 05-28-2012, 02:49 PM
  4. Replies: 0
    Last Post: 11-14-2011, 05:40 PM
  5. How to calculate something using equation from Chart' directly?
    By pujiyono in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-16-2006, 09:25 AM
  6. [SOLVED] How do I calculate times each word occurs in a column of cells?
    By MTSusce in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-18-2006, 08:35 PM
  7. Replies: 3
    Last Post: 01-31-2005, 08:06 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