[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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
"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.
 

smm3

Board Regular
Joined
Oct 30, 2004
Messages
67
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
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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
 

smm3

Board Regular
Joined
Oct 30, 2004
Messages
67
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
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Why are you using Selection? Why are your erasing a Q then putting a Q back later? What is this supposed to do exactly?
 

smm3

Board Regular
Joined
Oct 30, 2004
Messages
67
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
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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
 

smm3

Board Regular
Joined
Oct 30, 2004
Messages
67
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
 

Forum statistics

Threads
1,181,730
Messages
5,931,707
Members
436,799
Latest member
BasOo

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
Top