need to have cell fill when I select the cell

B

Bob

I would like to have a cell either fill with a color or have an x inserted
or something. It doesn't matter what goes into the cell. I need to set up
a column with cells that when I click on them they change. I am trying to
get out of having to type the word yes in every cell. Whatever goes into
the cell represents the word yes.
 
O

Otto Moehrbach

Bob
This macro does what you want. I selected Column C as the column. If
you click on any cell in Column C, a "Yes" will be put into that cell if
that cell is blank, and the cell will be cleared if it is not blank
This is a sheet event macro and must be placed in the module for the
sheet in question. To do this, Right-click on the sheet tab, select View
Code, and paste this macro into that module. HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 3 Then
If Target = "" Then
Target = "Yes"
Else
Target = ""
End If
Application.EnableEvents = False
[A1].Select
Application.EnableEvents = True
End If
End Sub
 
B

Bob

That is exactly what I was looking for. Thank you very much.
Otto Moehrbach said:
Bob
This macro does what you want. I selected Column C as the column. If
you click on any cell in Column C, a "Yes" will be put into that cell if
that cell is blank, and the cell will be cleared if it is not blank
This is a sheet event macro and must be placed in the module for the
sheet in question. To do this, Right-click on the sheet tab, select View
Code, and paste this macro into that module. HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 3 Then
If Target = "" Then
Target = "Yes"
Else
Target = ""
End If
Application.EnableEvents = False
[A1].Select
Application.EnableEvents = True
End If
End Sub
Bob said:
I would like to have a cell either fill with a color or have an x inserted
or something. It doesn't matter what goes into the cell. I need to set
up a column with cells that when I click on them they change. I am trying
to get out of having to type the word yes in every cell. Whatever goes
into the cell represents the word yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top