ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Leftclick = "x" (https://www.excelbanter.com/excel-discussion-misc-queries/114940-leftclick-%3D-x.html)

Ed

Leftclick = "x"
 
Hello, I need a macro that when I left-click on any cell within columns B:D I
get a "x" on the cell and if I click again I erase it...

any ideas?

,thanks

Carim

Leftclick = "x"
 
Hi,

May be with double click ...

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, Me.Range("B:B,D:D")) Is Nothing Then Exit
Sub
If .Value = "" Then
.Value = "X"
Else
.Value = ""
End If
End With
End Sub


HTH
Cheers
Carim


Ed

Leftclick = "x"
 
Hello Carim,

I tried the code you sent me but it gives me a: "Compile error: Syntax
error", on this part of the code:

If Intersect(.Cells, Me.Range("B:B,D:D")) Is Nothing Then Exit
Sub

What do I need to change?
,thanks

PCLIVE

Leftclick = "x"
 
If you want to include Column C in your range, then:

If Intersect(.Cells, Me.Range("B:D")) Is Nothing Then Exit Sub

"Ed" wrote in message
...
Hello Carim,

I tried the code you sent me but it gives me a: "Compile error: Syntax
error", on this part of the code:

If Intersect(.Cells, Me.Range("B:B,D:D")) Is Nothing Then Exit
Sub

What do I need to change?
,thanks




Carim

Leftclick = "x"
 
Hi Ed,

Since this is an event module, make sure to copy it into the sheet
module,
and, if column C is to be included, change range to "B:D" as indicated
by above contributor.

HTH
Cheers
Carim


Ed

Leftclick = "x"
 
Thanks, now it works!

,Ed

Carim

Leftclick = "x"
 
Glad I could help ...
Thanks for the feedback

Carim



All times are GMT +1. The time now is 06:08 AM.

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