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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

734 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