Solved

Adding a Doubleclick for Checkmarks

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

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