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

I would like to add a OnClick event to a cell using VBA: A user clicks
certain cell and then for instance a form pops up. I'm not sure if it's
possible.

So far I have used Workbook_SheetSelectionChange, with which I can monitor
whether a cell is selected... This works pretty well, but it also reacts
when a user is scrolling the cursor with the arrow-keys over the cell and
offcourse doesn't react when the cell is already selected and the user
clicks the cell.

Does anyone know an easier solution than the one I found, which covers the
problems I encounter?

Thanks for your help
Thijs van Bon


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default onclick event for cell

Hi Ties,

So far I have used Workbook_SheetSelectionChange, with which I can monitor
whether a cell is selected... This works pretty well, but it also reacts
when a user is scrolling the cursor with the arrow-keys over the cell and
offcourse doesn't react when the cell is already selected and the user
clicks the cell.


You could place a label control from the control toolbox on top of the cell
you wish the click event for and use the click event of the label. Make sure
the label has no caption and has the background and border set to none.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default onclick event for cell

Put this code in a worksheet module

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
MsgBox "Worksheet_BeforeDoubleClick"
End Sub

... or this code in the ThisWorkbook module.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
MsgBox "Workbook_SheetBeforeDoubleClick"
End Sub

Double clicking on any cell should achieve what you want.

--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



"ties" wrote in message
...
I would like to add a OnClick event to a cell using VBA: A user clicks
certain cell and then for instance a form pops up. I'm not sure if it's
possible.

So far I have used Workbook_SheetSelectionChange, with which I can monitor
whether a cell is selected... This works pretty well, but it also reacts
when a user is scrolling the cursor with the arrow-keys over the cell and
offcourse doesn't react when the cell is already selected and the user
clicks the cell.

Does anyone know an easier solution than the one I found, which covers the
problems I encounter?

Thanks for your help
Thijs van Bon




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default onclick event for cell

bedankt!

I'm sure this must work great!

Regards,
Thijs van Bon

"Jan Karel Pieterse" schreef in bericht
...
Hi Ties,

So far I have used Workbook_SheetSelectionChange, with which I can

monitor
whether a cell is selected... This works pretty well, but it also reacts
when a user is scrolling the cursor with the arrow-keys over the cell

and
offcourse doesn't react when the cell is already selected and the user
clicks the cell.


You could place a label control from the control toolbox on top of the

cell
you wish the click event for and use the click event of the label. Make

sure
the label has no caption and has the background and border set to none.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default onclick event for cell

This works (in the "before double click" even for the sheet):

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Selection = Range("A1") Then
'selection is always what you are double clicking coz you
'always select it by clicking once before you double click it
MsgBox "it works"
Else
End If
End Sub

HTH,

Damo


ties wrote:
I would like to add a OnClick event to a cell using VBA: A user clicks
certain cell and then for instance a form pops up. I'm not sure if
it's possible.

So far I have used Workbook_SheetSelectionChange, with which I can
monitor whether a cell is selected... This works pretty well, but it
also reacts when a user is scrolling the cursor with the arrow-keys
over the cell and offcourse doesn't react when the cell is already
selected and the user clicks the cell.

Does anyone know an easier solution than the one I found, which
covers the problems I encounter?

Thanks for your help
Thijs van Bon




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
OnClick [email protected] Excel Discussion (Misc queries) 1 August 31st 06 06:08 PM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Excel Worksheet Functions 1 June 23rd 05 07:53 PM
onClick action from cell selection Beanymonster Excel Programming 4 July 16th 04 09:25 PM
range onclick? Dennis Excel Programming 2 November 23rd 03 07:34 PM
Cell onclick make cell value increase. Cali92 Excel Programming 6 September 28th 03 02:27 AM


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

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

About Us

"It's about Microsoft Excel"