darkbearpooh1
New Member
- Joined
- Mar 5, 2011
- Messages
- 2
ok here is the whole vba page
ok this works perfect for me as i needed it before it essentially counts the colored cell giving it a time value it counts one cell as say 7am and if the second is colored it counts as 7:30 and the third as 8am for the start time, but now i need to modify the whole thing to count by 15 minutes instead of 30 minute intervals i have changed this part GetTime = TimeSerial(Int(j / 2), (j Mod 2) * 30, 0) to GetTime = TimeSerial(Int(j / 2), (j Mod 2) * 15, 0) and it does count the first colored block as 15 minutes but then the second and third should go up to 30 minutes then 45 then fourth to 1 hour increments but that only changes the first block to 15 minute and then the second goes to a round hour but it should be four blocks of 15 minutes to make the hour first
please help!!!
Code:
Function GetTime(rng As Range, ci As Long, Start As Boolean)
Dim cell As Range
Dim i As Long
Dim j As Long
If Start Then
For i = 1 To rng.Columns.Count
If rng.Columns(i).Interior.ColorIndex = ci Then
j = IIf(i > 25, i - 24, i)
GetTime = TimeSerial(Int(j / 2), (j Mod 2) * 30, 0)
Exit For
End If
Next i
Else
For i = rng.Columns.Count To 1 Step -1
If rng.Columns(i).Interior.ColorIndex = ci Then
j = IIf(i > 25, i - 24, i)
GetTime = TimeSerial(Int(j / 2), (j Mod 2) * 30, 0)
Exit For
End If
Next i
End If
End Function
ok this works perfect for me as i needed it before it essentially counts the colored cell giving it a time value it counts one cell as say 7am and if the second is colored it counts as 7:30 and the third as 8am for the start time, but now i need to modify the whole thing to count by 15 minutes instead of 30 minute intervals i have changed this part GetTime = TimeSerial(Int(j / 2), (j Mod 2) * 30, 0) to GetTime = TimeSerial(Int(j / 2), (j Mod 2) * 15, 0) and it does count the first colored block as 15 minutes but then the second and third should go up to 30 minutes then 45 then fourth to 1 hour increments but that only changes the first block to 15 minute and then the second goes to a round hour but it should be four blocks of 15 minutes to make the hour first
please help!!!
Last edited by a moderator: