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
160 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 80

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

759 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

19 Experts available now in Live!

Get 1:1 Help Now