Solved

Adding a Doubleclick for Checkmarks

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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 code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

825 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