Solved

Convert numbers to time with vba

Posted on 2013-01-23
7
320 Views
Last Modified: 2013-01-27
Guys, please see the attached file;

The file has the following code from ssaqibh, Posted on 1/18/2013, ID: 38795563

It works great to enter numbers without using the the colon, 645p results to 6:45 PM.

But if I enter a number ending with a zero, 650p, that results to 6:05 PM.

Please help me solve this problem with numbers ending with a zero.

Thank you for your help,

Robert
test-time.xlsm
0
Comment
Question by:rws1
  • 3
  • 2
  • 2
7 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 250 total points
ID: 38812785
Modify this line

                Target = CVDate(Replace(Format(Left(Target, Len(Target) - 1) / 100, "0.00"), ".", ":") & Right(Target, 1) & "m")
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38812793
You should always put such queries in the same thread instead of opening a new thread so that anyone viewing the previous thread gets the correct answer,

Alternatively you may put a link to the new question in the previous question.
0
 
LVL 26

Assisted Solution

by:redmondb
redmondb earned 250 total points
ID: 38812825
Hi, rws1.

My original version handles it correctly. I pointed out the other differences between it and ssaqibh's version. Do you want any of them changed?

Regards,
Brian.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:rws1
ID: 38812980
Thank you guys, your response were both exactly what I needed.

I thought I needed to start a new question so that points could be issued and I could get the answer to the question.
Are you saying that if I continued with the previous question it would have been answered without issuing points, please educate to me the rules. I am confused in this area.

Once again thank you, you guys are great.

Robert
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38813033
Thanks, Robert.

please educate to me the rules.
Unfortunately there are no hard and fast rules - it depends on the expert, how closely related the follow-on is to the original question, how much work it will involve and how long it is since the original question.

The best advice I can give you is to post in the closed question, but include a remark offering to open a new question. That should satisfy both extremes of expert opinion!

(Of course, opening a new question may have the advantage of bringing a fresh pair of eyes to your problem!)

Regards,
Brian.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38813122
I do not have anything against opening a new question but the most important thing is to get the previous thread connected with the correct answer.

I, for one, would be more than happy to correct any of my mistakes in an already closed thread. I am also open to getting a personal email for this if, for some reason, I miss the comment posted in the thread.
0
 

Author Comment

by:rws1
ID: 38824639
Thanks, guys I will remember your comments in the future.

Robert
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now