LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Is there a VBA Event to Detect Change in ActiveCell Focus?

Hi Larry

The reason you have to click out of the cell and then back in is because
the selectionchange event only fires when the selected cell on the sheet
changes. There is no way around that as far as I know. Short of
replaciing the X's with checkboxes you could change the event slightly
so that it moves the selection to column B afer a cell is clicked eg:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
If Target.Count = 1 And Target.Column = 1 And Target.Row 1 Then
If Target.Value = "X" Then
Target.Value = ""
Else
Target.Value = "X"
End If
End If
Target.Offset(0, 1).Select
ErrorHandler:
Application.EnableEvents = True
End Sub

The user then only has to click once each time to change a cell.

Hope this helps
Rowan

Larry A wrote:
This works but has one unexpected behavior. Once you click on a particular
cell, you cannot successively click to toggle back and forth. One must
first click on some other cell and then back again. But it's close. Any
other thoughts? Any way to create a behavior the same as a check box?
Thanks!!



 
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
What event to detect click on UserForm ListBox? Don Wiss Excel Programming 1 August 26th 05 10:35 PM
how to detect mouse pressed(down) event for work sheet helpwithXL Excel Programming 0 February 18th 05 03:05 PM
Detect event if excel is in edit mode. Rajeev Excel Programming 2 February 7th 04 02:22 PM
event which occurs when a TextBox receives focus Mikhail Excel Programming 2 October 7th 03 02:27 PM
How to detect an entire column/row delete event? MV[_2_] Excel Programming 1 September 10th 03 01:03 PM


All times are GMT +1. The time now is 09:23 AM.

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"