Solved

Convert numbers to time with vba

Posted on 2013-01-23
7
345 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 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

726 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