+ Reply to Thread
Results 1 to 2 of 2

Thread: VBA formula

  1. #1
    Registered User
    Join Date
    08-25-2011
    Location
    Brooklyn,NY
    MS-Off Ver
    Excel 2003
    Posts
    1

    VBA formula

    I get an excel spread sheet from a client that has cells showing hours and minutes separated with a decimal.

    Say 40 hours, 59 minutes is displayed:
    40.59

    I need to convert that to decimal minutes so the above should become:
    40.98

    I found a formula online that does this conversion in another cell.

    =IF(ISERROR(RIGHT(A1,LEN(A1)-FIND(".",A1)+1)),A1,LEFT(A1,FIND(".",A1)-1)+(ROUND((RIGHT(A1,LEN(A1)-FIND(".",A1)+1)/0.6),2)))
    Can i create a vba script to run this formula on a range of cells and have the result of the formula overwrite the original cell's value?



    I've created the Range so far...

    Dim X As Range
        On Error Resume Next
            Set X = Application.InputBox(Prompt:="Select the [HH].MM cells", Title:="Time to Decimal", Type:=8)
    where do i go from here?
    Last edited by HeshMan; 08-26-2011 at 11:56 AM.

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: VBA formula

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0