Help creating a rubric

Closed
RJoz Posts 1 Registration date Sunday February 25, 2018 Status Member Last seen February 25, 2018 - Feb 25, 2018 at 01:26 AM
 RJoz - Feb 27, 2018 at 04:16 AM
Hello folks,

I have used some VBA in excel before, but I am wondering how to go about programming a macro to be used in a rubric so that I can double click to select one cell in a column and upon selection the background colour would change and if other cells in this column had previously been selected, their background colour would return to white or no background colour. Can anyone help with this?

I am currently playing with a Private Sub Worksheet_BeforeDoubleClick and can change the background colour of one cell by double clicking on it, but I am not sure how to change the other cells back to white once I double click on a different cell in the same column. I concept is to be able to select cells in a rubric that would remain with a different background colour.

Look forward to a response.
Thanks

1 response

vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
Feb 26, 2018 at 06:59 AM
Hello RJoz,

You could try the following:-

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

      Dim c As Range

If ActiveCell.Column = 1 Then

For Each c In Columns(1)
      c.Interior.ColorIndex = xlNone
      ActiveCell.Interior.ColorIndex = 8
      Next c
End If

End Sub


The above code is based on Column A (or 1).

It will colour the active cell with colour index 8 (which I think is cyan) and will convert any other already coloured cell in Column A back to white (xlNone).

I hope that this helps.

Cheerio,
vcoolio.
0
Many thanks for your reply. I will try this code.
Cheers,
R
0