Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding a Doubleclick for Checkmarks

Posted on 2014-03-18
4
Medium Priority
?
130 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
[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
4 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 1000 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 1000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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,…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

661 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