P
pikus
I just wrote the following code to convert hours and minutes to decimal
numbers. This is a test run to prepare for the real deal so it's kind
of ugly. The problem is that the variable "min" which is declaired as
a LONG is only giving me back whole numbers. What do I do to stop
that??? Thanks in advance - Pikus
Private Sub Test_Click()
Dim wd As String
Dim time As Long
Dim hr As Long
Dim min As Long
wd = "Saturday"
Do
y = y + 1
Loop Until Worksheets(wd).Cells(y + 1, 1).Value = ""
For x = 1 To y
Worksheets(wd).Cells(x, 4).Value = "=HOUR(C" & x & ")"
hr = Worksheets(wd).Cells(x, 4).Value
Worksheets(wd).Cells(x, 5).Value = "=MINUTE(C" & x & ")"
min = Worksheets(wd).Cells(x, 5).Value
min = min / 60
Worksheets(wd).Cells(x, 6).Value = min
time = hr + min
Worksheets(wd).Cells(x, 7).Value = time
Next x
End Sub
numbers. This is a test run to prepare for the real deal so it's kind
of ugly. The problem is that the variable "min" which is declaired as
a LONG is only giving me back whole numbers. What do I do to stop
that??? Thanks in advance - Pikus
Private Sub Test_Click()
Dim wd As String
Dim time As Long
Dim hr As Long
Dim min As Long
wd = "Saturday"
Do
y = y + 1
Loop Until Worksheets(wd).Cells(y + 1, 1).Value = ""
For x = 1 To y
Worksheets(wd).Cells(x, 4).Value = "=HOUR(C" & x & ")"
hr = Worksheets(wd).Cells(x, 4).Value
Worksheets(wd).Cells(x, 5).Value = "=MINUTE(C" & x & ")"
min = Worksheets(wd).Cells(x, 5).Value
min = min / 60
Worksheets(wd).Cells(x, 6).Value = min
time = hr + min
Worksheets(wd).Cells(x, 7).Value = time
Next x
End Sub