Help creating a rubric

RJoz 1 Posts Sunday February 25, 2018Registration date February 25, 2018 Last seen - Feb 25, 2018 at 01:26 AM - Latest reply:  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.
See more 

2 replies

Reply to this topic
vcoolio 1152 Posts Thursday July 24, 2014Registration dateModeratorStatus March 22, 2018 Last seen - 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.

Many thanks for your reply. I will try this code.
Respond to vcoolio