ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Mouse click automatically enters character into cell. (https://www.excelbanter.com/excel-worksheet-functions/146715-mouse-click-automatically-enters-character-into-cell.html)

Jeffrey M. Coffin

Mouse click automatically enters character into cell.
 
How can I set up a cell to respond to a mouse click by entering a check mark?

Gary''s Student

Mouse click automatically enters character into cell.
 
How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?


Jeffrey M. Coffin

Mouse click automatically enters character into cell.
 
Not getting it to run. Boolean) is on the second line (separate from the
start of the parenthetical expression. Is that intended?

"Gary''s Student" wrote:

How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?


Vasant Nanavati

Mouse click automatically enters character into cell.
 
"Cancel As Boolean" is a single phrase.

__________________________________________________ _______________________

"Jeffrey M. Coffin" wrote in
message ...
Not getting it to run. Boolean) is on the second line (separate from the
start of the parenthetical expression. Is that intended?

"Gary''s Student" wrote:

How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check
mark?




Gary''s Student

Mouse click automatically enters character into cell.
 
Cancel = True
is the second line. above it is the first line - all one line.

REMEMBER worksheet code, not a standard module
--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

Not getting it to run. Boolean) is on the second line (separate from the
start of the parenthetical expression. Is that intended?

"Gary''s Student" wrote:

How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?


Jeffrey M. Coffin

Mouse click automatically enters character into cell.
 
How does one enter worksheet code?

"Gary''s Student" wrote:

Cancel = True
is the second line. above it is the first line - all one line.

REMEMBER worksheet code, not a standard module
--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

Not getting it to run. Boolean) is on the second line (separate from the
start of the parenthetical expression. Is that intended?

"Gary''s Student" wrote:

How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?


T. Valko

Mouse click automatically enters character into cell.
 
Navigate to the sheet where you want this to happen.
Right click on the sheet tab and select View Code
Paste the code into the right side of the window that opens.
Click the "X" to close the VBE and return to Excel.

Double click in a cell and see if it works.

Biff

"Jeffrey M. Coffin" wrote in
message ...
How does one enter worksheet code?

"Gary''s Student" wrote:

Cancel = True
is the second line. above it is the first line - all one line.

REMEMBER worksheet code, not a standard module
--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

Not getting it to run. Boolean) is on the second line (separate from
the
start of the parenthetical expression. Is that intended?

"Gary''s Student" wrote:

How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a
check mark?




Renee R.

Mouse click automatically enters character into cell.
 
Hi All,
Would it be possible to do this on one click by pre-populating the cells
with check marks in a white font and then having the color changed to black
on the click event?

If so, how would one go about creating the code for that to happen
automatically?

"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?


Gary''s Student

Mouse click automatically enters character into cell.
 
Hi Renee:

Your method would also work. I would still implement it with double-click.
The problem with single-click is that the event triggers on ANY selection,
not just the mouse. So moving into the cell with the arrow keys would also
trip the action.
--
Gary''s Student - gsnu200730


"Renee R." wrote:

Hi All,
Would it be possible to do this on one click by pre-populating the cells
with check marks in a white font and then having the color changed to black
on the click event?

If so, how would one go about creating the code for that to happen
automatically?

"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?


Vasant Nanavati

Mouse click automatically enters character into cell.
 
Minor clarification: there is no Click or BeforeClick event for the
worksheet, so you would use the SelectionChange method which, as you point
out, has other triggers.

The BeforeRightClick method could be substituted for the BeforeDoubleClick
method if the OP doesn't want to click twice. <g
__________________________________________________ ______________________

"Gary''s Student" wrote in message
...
Hi Renee:

Your method would also work. I would still implement it with
double-click.
The problem with single-click is that the event triggers on ANY selection,
not just the mouse. So moving into the cell with the arrow keys would
also
trip the action.
--
Gary''s Student - gsnu200730


"Renee R." wrote:

Hi All,
Would it be possible to do this on one click by pre-populating the cells
with check marks in a white font and then having the color changed to
black
on the click event?

If so, how would one go about creating the code for that to happen
automatically?

"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check
mark?




EP

Mouse click automatically enters character into cell.
 
right click on the Sheet you want to add the code to and select "View
Code" then the VB window will open and past the following:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub



Jeffrey M. Coffin wrote:
How does one enter worksheet code?

"Gary''s Student" wrote:

Cancel = True
is the second line. above it is the first line - all one line.

REMEMBER worksheet code, not a standard module
--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

Not getting it to run. Boolean) is on the second line (separate from the
start of the parenthetical expression. Is that intended?

"Gary''s Student" wrote:

How about a double-click??

Put this in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Font.Name = "Wingdings 2"
Target.Value = Chr(80)
End Sub


--
Gary''s Student - gsnu200730


"Jeffrey M. Coffin" wrote:

How can I set up a cell to respond to a mouse click by entering a check mark?



All times are GMT +1. The time now is 10:51 PM.

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