Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:47:27+00:00 2026-06-04T17:47:27+00:00

Very new to working with Visual Basic / Excel. I am trying to write

  • 0

Very new to working with Visual Basic / Excel. I am trying to write a quick script that enters the current time in one column, and allows the user to enter how many days/hours/minutes will pass until a new time, and output that in another column.

I’m sure this isn’t the best way to do it, but what I have so far is the following. I have given up on fiddling with dates, and am just working with the time:

Sub TimeModule()
Dim DaysLeft, HoursLeft, MinutesLeft As Double
DaysLeft = Val(InputBox("Days left"))
HoursLeft = Val(InputBox("Hours left"))
MinutesLeft = Val(InputBox("Minutes left"))

Dim CurrentTime As Date
CurrentTime = TimeValue(Now())

ActiveCell.Value = CurrentTime
ActiveCell.Offset(0, 1) = CurrentTime + Time(HoursLeft, MinutesLeft, 0)

End Sub

I am getting an error, of course. If anyone could shed some light on a better way to do this, along with the functions I’m misusing, I would really appreciate it!

Edit: I would, of course ultimately like for the script to handle days as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:47:29+00:00Added an answer on June 4, 2026 at 5:47 pm

    I think this is possible just using cell functions in Excel, if I’ve understood you correctly.

    For example, this is what you’d see…

    Time Now:           Days:   Hours:  Minutes:    New Time:
    30/05/2012 23:34    15      6       23          15/06/2012 05:57
    

    …and this is what is in each cell (assuming top-left cell is A1)…

    Time Now:   Days:   Hours:  Minutes:   New Time:
    =NOW()      15      6       23         =A2+B2+TIME(C2,D2,0)
    

    Describing each function:

    • NOW() returns the current date and time formatted as a date and time.
    • DATE(year,month,day) returns the number that represents the date in MS Excel date-time code.
    • TIME(hours,minutes,seconds) converts hours, minutes, and seconds given as numbers to an Excel serial number, formatted with a time format.

    Dissecting the equation in the last cell:

    • A2 is the cell containing the current date/time (as of last worksheet calculation).
    • B2 is the user-inputted value for days.
    • TIME(C2,D2,0) is the TIME() function, taking the user-inputted values for hours and minutes from cells C2 and D2 respectively.

    Is this anything like your intended functionality…?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a script that generates Visual Studio 2005 C++ project files (.vcproj).
I'm trying to write a simple/small Windows Communication Foundation service application in Visual Basic
I'm very new to working with databases in C# (but not C# itself) and
Very new to .Net. Everything was working fine until I added <Tracking> to my
I am very new at C programming and I am working on a firmware
I'm very new to backbone but I manage to get it working from tutorial.
I am very new to JS, have been working in C/C++ before, I need
I am VERY new to PHP, I'm currently working on a service, part which
I'm very new to JavaScript in general so having trouble with this. Working with
I'm very new to Scala! However, I have the following working solution to Euler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.