?
Solved

editing a cell( via doubleclicking)  vs  Copying /cut and pasting or scrolling through cells in a specific Column

Posted on 2013-11-15
2
Medium Priority
?
202 Views
Last Modified: 2013-11-17
Excel 2010 vba..


I have a variable that holds a specific Column Number for other purposes.
trColumn as String

I need to know:
Is there a way, that if i "Double Click in a cell anywhere  in that specific Column.

I can fire off an event...?

If a person copys/cuts and pastes or scrolls on cells in that Column...or anything else...
I do not want the event fired off?

The event i want to capture this  in is:

Private Sub xlApp_SheetChange(ByVal Sh As Object, ByVal Target As Range)

or maybe here ?

Private Sub xlApp_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)


I think something like this would work.
 
If i know  trColumn  = "H"

Select Case ActiveCell.Address
   
    Case "$trColumn"  ?

         'do something for column trColumn

    Case Else
         'do nothing
    End Select



Thanks
fordraiders
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 2000 total points
ID: 39652638
There are two ways to trap a doubleclick. One is the Workbook_SheetBeforeDoubleClick events sub that responds to a doubleclick in any cell in the workbook. It is installed in the ThisWorkbook code pane. The other is a Worksheet_BeforeDoubleClick sub that responds only to doubleclicks on cells in that worksheet. I believe this latter sub is what you want; it is installed in the code pane for the worksheet.
'The following sub goes in the code pane for the worksheet being watched. It won't work at all if installed anywhere else.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 8 Then   'A cell in column H was doubleclicked
    Cancel = True   'Turn off the normal "edit the cell" response to a doubleclick
    'do something
End If
End Sub

Open in new window

0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39654809
Thanks...! again very much
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question