Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert numbers to time with vba

Posted on 2013-01-23
7
Medium Priority
?
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 1000 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 1000 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

618 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