Hello All, First let me state that I am a complete novice to macros and vba. However, I am able to reverse engineer existing macros and vba code to en extent. I was able to locate the macro below from this this forum. I made some changes to suit my needs and it works beautifully.
My problem is that the macro will not rerun when there is new call data added to the table. The macro converts all of the existing data, but it will not convert new time data added to it.
Example:
9/1 data is converted from seconds
9/2 added data for this date, but macro will not run again it says already converted.
Here is the macro I am using currently, but I want to be able to convert newly added data to the sheet .
My problem is that the macro will not rerun when there is new call data added to the table. The macro converts all of the existing data, but it will not convert new time data added to it.
Example:
9/1 data is converted from seconds
9/2 added data for this date, but macro will not run again it says already converted.
Here is the macro I am using currently, but I want to be able to convert newly added data to the sheet .
Code:
Sub Test()
Dim LR As Long
Dim r As Long
With Worksheets("Sheet1")
If .Range("E3").NumberFormat = "[hh]:mm:ss" Then
MsgBox "Already converted!"
Exit Sub
End If
LR = .Cells(.Rows.Count, 1).End(xlUp).Row
For r = 2 To LR
With .Range("D" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("E" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("F" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("G" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("I" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("J" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("K" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("L" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("M" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("N" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("P" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("R" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("Z" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
With .Range("AA" & r)
.Value = .Value / 86400
.NumberFormat = "[hh]:mm:ss"
End With
Next r
End With
End Sub
Last edited by a moderator: