[size=7]Help me Help me[/size]

smm3

Board Regular
Joined
Oct 30, 2004
Messages
67
Help me Help me

I have this great code, but I can;t figure out how to add more columns to it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 2 Then
If Target.Value = "Q" Then
With Target
.Value = ""
End With

Else
With Target
With Selection.Font
.Name = "Wingdings 2"
.Size = 22
End With
.Value = "Q"
End With
End If
Cancel = True
End If
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
"If Target.Column = 2 Then " for only Column 2.

If (Target.Column = 2 Or Target.Column = 4) Then for ether Column 2 or 3.

If (Target.Column = 2 And Target.Column = 4) Then for both Column 2 and 3.

If (Target.Column > 2 And Target.Column < 11) Then for any Column 3 through 10.
 
Upvote 0
I'm trying to get columns 3 throught 11, but I can't get the last post to work at all. I tried all three examples.

Vickie
 
Upvote 0
Try

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column <= 2 Or Target.Column > 11 Then Exit Sub
    If Target.Value = "Q" Then
    With Target
        .Value = ""
        End With

        Else
        With Target
        With Selection.Font
             .Name = "Wingdings 2"
            .Size = 22
        End With
    .Value = "Q"
    End With
    End If
    Cancel = True
    End If
End Sub
 
Upvote 0
Nope, that didn't work either. When I try to use it this is highlighted in yellow.

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

Vickie
 
Upvote 0
Why are you using Selection? Why are your erasing a Q then putting a Q back later? What is this supposed to do exactly?
 
Upvote 0
I don't even know what Selection pertains to and I changed the Q to a P and that let me put a checkmaark in the cell just be clicking in it twice.

Vickie
 
Upvote 0
Does this do what you want?

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim d As Range
Set d = Intersect(Range("C:K"), Target)
If d Is Nothing Then Exit Sub
With d
    .Value = "P"
    .Font.Name = "Wingdings 2"
    .Font.Size = 22
End With
End Sub
 
Upvote 0
Hotpepper!

Works great! But it doesn't seem fair. You do all the work!

You'll never know how much I appreciate your help!!!!!!

Vickie
 
Upvote 0

Forum statistics

Threads
1,214,615
Messages
6,120,538
Members
448,970
Latest member
kennimack

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top