Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2007
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    running a macro on a cell (2003 SP2)

    Hi everyone

    I am looking to apply a macro to a series of calls. I dont crfeate excel macros that often and am not sure how to apply it to a cell the macro I have created is

    ActiveCell.FormulaR1C1 = "=(*60)/86400"
    Selection.NumberFormat = "[>0.041666][h]:mm:ss;[>0.000694]m:ss;:ss"

    but I need the formula to be applied to the cell I am on ie the "=(*60)/86400" part. I am not sure how to do this and if I put a cell reference in it will loo for that cell. Any help would be much appreciated.

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: running a macro on a cell (2003 SP2)

    Does the following do what you are looking for?



    Dim cCell As Range
    For Each cCell In Selection
    cCell.Value = cCell * 60 / 86400
    Selection.NumberFormat = "[>0.041666][h]:mm:ss;[>0.000694]m:ss;:ss"
    Next

  3. #3
    Lounger
    Join Date
    Mar 2007
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: running a macro on a cell (2003 SP2)

    that works perfectly - thats very much for your help

Posting Permissions

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