Solved

Adding a Doubleclick for Checkmarks

Posted on 2014-03-18
4
126 Views
Last Modified: 2014-03-19
EE Pros,

I need a macro that looks at a matrix of cells (columns G - T and below Row 4....could be set up as a rangename) and when a cell is "doubleclicked" a checkmark (Wingding2 with "P") will automatically appear in the cell.

Thank you in advance!

B.
Add-doubleclick-check.xlsm
0
Comment
Question by:Bright01
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 250 total points
ID: 39938314
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Provides check button
    If Not Intersect(Range("G5:T1048576"), Target) Is Nothing Then
        Application.ScreenUpdating = False
        With ActiveCell
            If .Value = "P" Then
                .Value = ""
            Else
                .Font.Name = "Wingdings 2"
                .Value = "P"
            End If
        End With
        'These two lines below make it a realtime update
        Cancel = True
        Application.ScreenUpdating = True
    End If
End Sub

Open in new window

0
 
LVL 39

Assisted Solution

by:nutsch
nutsch earned 250 total points
ID: 39938316
Something like this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target.Column > 6 And Target.Column < 21 And Target.Row > 2 Then

With ActiveCell
    If .Value = "P" Then
    .Value = ""
    Else
    .Font.Name = "Wingdings 2"
    .Value = "P"
   End If
End With
'These two lines below make it a realtime update vs. using a button and the sub "sumup"
Cancel = True
'sumup
End If
End Sub

Open in new window


Thomas
0
 

Author Closing Comment

by:Bright01
ID: 39939129
Thanks guys!  Both solutions worked!  Appreciate the help.  

One quick question; instead of using a hard coded table range, would I be better off using a Range name so that if columns are added, it wouldn't break the Macro?

B.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39939173
Yes.
Change:
If Not Intersect(Range("G5:T1048576"), Target) Is Nothing Then

Open in new window

to:
If Not Intersect(Range(YourNamedRange), Target) Is Nothing Then

Open in new window

0

Featured Post

Technology Partners: 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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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 using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

679 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