VBA insert tick

sturnusek

Board Regular
Joined
Sep 20, 2018
Messages
51
Hi there,

I have found the below code on the internet to do what I want, but when I want to expand the range it comes up with an error . Any one has any idea how to include H:H, J:J, L:L and N:N sections to it?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)'Updateby Extendoffice
If Target.Cells.Count = 1 Then
If Not Intersect(Target, Range("H:H", "J:J")) Is Nothing Then
With Target
.Font.Name = "Wingdings"
.Font.Size = 12
If .FormulaR1C1 = " û " Then
.FormulaR1C1 = "ü"
Else
.FormulaR1C1 = " û "
End If
End With
End If
Cancel = True
End If
End Sub

Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi, you could give this a try..

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'Updateby Extendoffice
If Target.Cells.Count = 1 Then
    If Not Intersect(Target, Range("H:H,J:J,L:L,N:N")) Is Nothing Then
        With Target
            .Font.Name = "Wingdings"
            .Font.Size = 12
            If .FormulaR1C1 = " û " Then
                .FormulaR1C1 = "ü"
            Else
                .FormulaR1C1 = " û "
            End If
        End With
        Cancel = True
    End If
End If
End Sub
 
Upvote 0
Hi,

I tried this solution before, but it came up with a Range error. I managed to overcome the problem using the original code, but populating my data a bit different.

Thanks for your help though!
 
Upvote 0
i tried this solution before, but it came up with a Range error.

Hi, did you notice the difference here:
Rich (BB code):
If Not Intersect(Target, Range("H:H,J:J,L:L,N:N")) Is Nothing Then


Versus what you had:
Rich (BB code):
If Not Intersect(Target, Range("H:H", "J:J")) Is Nothing Then

I managed to overcome the problem using the original code, but populating my data a bit different.

Good to hear :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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