Solved

Convert numbers to time with vba

Posted on 2013-01-23
7
309 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

760 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

17 Experts available now in Live!

Get 1:1 Help Now