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
172 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
2 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now