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
201 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

728 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