Solved

Convert numbers to time with vba

Posted on 2013-01-23
7
348 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
Technology Partners: 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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…

717 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