First off i would like to say hello and good day, i am a new member here but hope to become an active contributor. ^^
Ok so here is an issue i am having. My work has given me the roster to edit. The shifts are shown by a purple line made of colored cells which starts at the start of the shift and ends at the end of the shift.
What they want me to do is to fill the two columns labeled Start Time and Finish Time (which i have selected in the pic) dynamically so that if they change the form of the line then the columns would reflect that. I figured the best way to do this was to use if statements to check for the first and last colored cell using VBA because those are the only ones important. but i am getting compiler errors.
Here is what i have got so far.
Any help would be much appreciated.
Ok so here is an issue i am having. My work has given me the roster to edit. The shifts are shown by a purple line made of colored cells which starts at the start of the shift and ends at the end of the shift.
What they want me to do is to fill the two columns labeled Start Time and Finish Time (which i have selected in the pic) dynamically so that if they change the form of the line then the columns would reflect that. I figured the best way to do this was to use if statements to check for the first and last colored cell using VBA because those are the only ones important. but i am getting compiler errors.
Here is what i have got so far.
Code:
Function startfin(active As Range)
Dim left, right As Integer
Dim start, fin, currentrow As Integer
left = active.Offset(0, -1)
right = active.Offset(0, 1)
currentrow = active.Row
timecolumn = active.Column + 1
Select Case active.Interior.ColorIndex
Case 2 And left = 1
Cells(currentrow, 3) = timecolumn
Case 2 And right = 1
Cells(currentrow, 4) = timecolumn
End Select
End Function