Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mark selected cell

Status
Not open for further replies.

Pekka

Technical User
Mar 19, 2002
107
FI
Hi,
I would like to avoid using check boxes in my worksheet. I wonder if it's possible to 'mark' selected cell. I mean if I select cell A1 it's value would be 'X'. I mean something pseudo like if range selected = True then range.value='X'

Pekka

"every dog will have his day"
 
Try this:
Private Sub Worksheet_Change(ByVal Target as Range)
Target = "X"
End Sub

and put it in the respective sheet's code.

MakeItSo


Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Ok, that's fine and handy. What I'm looking for is somethinq similar than if you use check boxes. If you select it, it returns a value and second time it returns it back. E.g if I pres mouse on A1 it gets 'X' and when I select it again it gets Null. Maybe I try check boxes because they allready there.

Pekka

"every dog will have his day"
 
Good idea, but you can also do it with X's:
Private Sub Worksheet_Change(ByVal Target as Range)
if Target="X" Then
Target=vbNullString
else
Target = "X"
endif
End Sub
 
Right, that's a good start for me. In your example the cell will never keep that 'X'.
 
Sorry Andreas, I missed:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

It's working like charm!

Pekka

"every dog will have his day"
 
Aaahh yes! I was just roaming around looking for the right Procedure... ;-)
[thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top