Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default WorkSheet_Change event

I am trying to create a simple code to place/remove a 'X' in a various cells across a sheet IF the cell is clicked.
There are about 20 individual cells:
A12,A14,A16,A18.A20,A22,A24,E12,E14,E16,E18,E20,E2 2,E24,
K12,K14,K16,K18,K20,K22,K24,Q,12,Q14,Q16, Q20,Q22,Q24.

If the user selects one of the cells, then a 'X' appears.
If the cell already had a 'X' in it, then the cell clears.

How can i accomplish this ?


--
Corey ....
The Silliest Question is generally
the one i forgot to ask.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default WorkSheet_Change event

It might be a little primitive, you could set up a If...Then...ElseIf
algorithm for those cells using the Worksheet SelectionChange event.

"Corey" wrote:

I am trying to create a simple code to place/remove a 'X' in a various cells across a sheet IF the cell is clicked.
There are about 20 individual cells:
A12,A14,A16,A18.A20,A22,A24,E12,E14,E16,E18,E20,E2 2,E24,
K12,K14,K16,K18,K20,K22,K24,Q,12,Q14,Q16, Q20,Q22,Q24.

If the user selects one of the cells, then a 'X' appears.
If the cell already had a 'X' in it, then the cell clears.

How can i accomplish this ?


--
Corey ....
The Silliest Question is generally
the one i forgot to ask

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default WorkSheet_Change event

You could probably do it with just a If..Then..Else statement using the Or
operator for each cell, but it would still be a long statement.

"Corey" wrote:

I am trying to create a simple code to place/remove a 'X' in a various cells across a sheet IF the cell is clicked.
There are about 20 individual cells:
A12,A14,A16,A18.A20,A22,A24,E12,E14,E16,E18,E20,E2 2,E24,
K12,K14,K16,K18,K20,K22,K24,Q,12,Q14,Q16, Q20,Q22,Q24.

If the user selects one of the cells, then a 'X' appears.
If the cell already had a 'X' in it, then the cell clears.

How can i accomplish this ?


--
Corey ....
The Silliest Question is generally
the one i forgot to ask



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default WorkSheet_Change event

A re-read did say IF clicked. How about IF double clicked.
Right click sheet tabview codecopy/Paste thisfinish adding your ranges.
Then, when appropriate cells are double clicked the macro will fire.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("a12,a14,a16,a18")) Is Nothing Then Exit Sub
If UCase(Target) = "X" Then Target.Replace "X", ""
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Corey" wrote in message
...
I am trying to create a simple code to place/remove a 'X' in a various cells
across a sheet IF the cell is clicked.
There are about 20 individual cells:
A12,A14,A16,A18.A20,A22,A24,E12,E14,E16,E18,E20,E2 2,E24,
K12,K14,K16,K18,K20,K22,K24,Q,12,Q14,Q16, Q20,Q22,Q24.

If the user selects one of the cells, then a 'X' appears.
If the cell already had a 'X' in it, then the cell clears.

How can i accomplish this ?


--
Corey ....
The Silliest Question is generally
the one i forgot to ask.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default WorkSheet_Change event

With selection change event, something like below.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Count 1 Then Exit Sub

If Intersect(Target,
Me.Range("A12,A14,A16,A18,A20,A22,A24,E12,E14,E16, E18,E20,E22,E24,K12,K14,K16,K18,K20,K22,K24,Q12,Q1 4,Q16,Q20,Q22,Q24"))
Is Nothing Then Exit Sub

If Len(Target) = 0 Then
Target.Value = "x"
Exit Sub
Else
Target.Value = ""
End If

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_Change event Joanne Excel Programming 8 January 10th 08 08:42 AM
Worksheet_Change Event thewizz Excel Programming 4 November 2nd 07 02:15 PM
Worksheet_Change event Sandy Excel Programming 3 August 4th 07 12:23 PM
How do I change a Worksheet_change event to a beforesave event? Tueanker Excel Programming 5 June 29th 07 03:00 PM
Worksheet_Change Event cmcfalls[_4_] Excel Programming 3 April 12th 04 09:47 PM


All times are GMT +1. The time now is 04:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"