ABrown
07-20-2009, 06:16 AM
Hi - I wonder if someone can help. I am putting together a spreadsheet which is almost complete except for two small issues - one is I need the active row highlighted and I have used the following code:
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
r = Selection.Row
c = Selection.Column
rr = r
cc = c
With Columns(c).Interior
.ColorIndex = 20 .Pattern = xlSolid
End With
With Rows(r).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
End Sub
But in the spreadsheet the pasting stops working if I add this to the Workbook.
Secondly is a formula - I have two dates/times - formatted for time from which I take the earlier date away from the later date giving me the elapsed time (ie the time spent working on a project). I then format this for hh:mm, but I also need to display it is periods of 6 minutes, rounded up to the nearest 6 minutes.
Can anyone help with either problem.
Many thanks.
Annette
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
r = Selection.Row
c = Selection.Column
rr = r
cc = c
With Columns(c).Interior
.ColorIndex = 20 .Pattern = xlSolid
End With
With Rows(r).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
End Sub
But in the spreadsheet the pasting stops working if I add this to the Workbook.
Secondly is a formula - I have two dates/times - formatted for time from which I take the earlier date away from the later date giving me the elapsed time (ie the time spent working on a project). I then format this for hh:mm, but I also need to display it is periods of 6 minutes, rounded up to the nearest 6 minutes.
Can anyone help with either problem.
Many thanks.
Annette