Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Converting a cell to minutes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Plusone - 04 Jul 2006 15:00 GMT
Hello

I need to enter a number of hours into a cell and it will work out the
amount in minutes. Obviously i could do this with a calculation in
another cell (=sum(A1*60)...

However i need it to work it out in the cell that i put the number of
hours in. For example i will enter 2 and it will change it to 180.

Is this possible?

Kind Regards,
Darren Stewart

Signature

Plusone

Scoops - 04 Jul 2006 15:49 GMT
> Hello
>
[quoted text clipped - 6 lines]
>
> Is this possible?

Hi Darren

Right-click the sheet tab > View Code.
This will open the vb editor, paste the code below into window headed
"General" and "Declarations":

Private Sub Worksheet_Change(ByVal Target As Range)
   Application.EnableEvents = False
   If Target.Column = 1 Then Target = Target * 60
   Application.EnableEvents = True
End Sub

The macro checks to see if the cell changed is in column 1 (A) and then
multiplies it by 60 if it was.

Amend the column (or .Row) as you need it.

The EnableEvents prevents the macro firing again when it enters the new
figure.

And, hopefully, you'll find that 2 = 120 ;-)

Regards

Steve
Scoops - 04 Jul 2006 15:53 GMT
> > Private Sub Worksheet_Change(ByVal Target As Range)
>     Application.EnableEvents = False
>     If Target.Column = 1 Then Target = Target * 60
>     Application.EnableEvents = True
> End Sub

If you're only concerned with one cell, this might be better:

If Target.Address = "$A$1"

Amend as necessary.

Regards

Steve

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.