Solved

Adding a Doubleclick for Checkmarks

Posted on 2014-03-18
4
120 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 26

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 26

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

743 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

12 Experts available now in Live!

Get 1:1 Help Now