ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Doubleclick (https://www.excelbanter.com/excel-programming/406496-doubleclick.html)

Jock

Doubleclick
 
If I double click a cell in column B, I'd like a tick to appear in the cell.
Formatting the font in a cell to Wingdings2 and using the character 'P' will
give a tick.
Any ideas?
--
Traa Dy Liooar

Jock

Les Stout[_2_]

Doubleclick
 
Hi Jock,

You must past the code below into the worksheet Code that you want to
use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Application.Intersect(Target, Columns("B:B")) Is Nothing Then
With Selection.Font
.Name = "Wingdings 2"
.Size = 10
End With
ActiveCell = "P"
End If

End Sub


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Jock

Doubleclick
 
Thanks Les. Works great until I password protect the worksheet.
The (amended) code below does the job but after every doubleclick although
the tick appears, so does a message saying the cell is protected and
therefore read only.
What a pain! Any ideas?

Private Sub Worksheet_BeforeSingleClick(ByVal Target As Range, Cancel As
Boolean)
ActiveSheet.Unprotect Password:="sulby"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Application.Intersect(Target, Columns("B:B")) Is Nothing Then
ActiveCell = "P"
With Selection.Font
.Name = "Wingdings 2"
.Size = 10
End With
End If

ws_exit:
Application.EnableEvents = True
ActiveSheet.Protect Password:="sulby"
End Sub

Thanks
--
Traa Dy Liooar

Jock


"Les Stout" wrote:

Hi Jock,

You must past the code below into the worksheet Code that you want to
use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Application.Intersect(Target, Columns("B:B")) Is Nothing Then
With Selection.Font
.Name = "Wingdings 2"
.Size = 10
End With
ActiveCell = "P"
End If

End Sub


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com