Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is there any way to place an "X" in any cell of my choosiing by clicking on
it or by touching the cell with a stylus from a touch screen tablet? -- rwfster |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How about a double-click??
Insert the following event macro in the worksheet code area: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Cancel = True Target.Value = "X" End Sub Because it is worksheet code, it is very easy to install and automatic to use: 1. right-click the tab name near the bottom of the Excel window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you have any concerns, first try it on a trial worksheet. If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200835 "rwfster" wrote: Is there any way to place an "X" in any cell of my choosiing by clicking on it or by touching the cell with a stylus from a touch screen tablet? -- rwfster |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Gary, it works well, yet I consider it a bit dangerous as u cannot make undo
when accidentally double click... "Gary''s Student" wrote: How about a double-click?? Insert the following event macro in the worksheet code area: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Cancel = True Target.Value = "X" End Sub Because it is worksheet code, it is very easy to install and automatic to use: 1. right-click the tab name near the bottom of the Excel window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you have any concerns, first try it on a trial worksheet. If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200835 "rwfster" wrote: Is there any way to place an "X" in any cell of my choosiing by clicking on it or by touching the cell with a stylus from a touch screen tablet? -- rwfster |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You are correct.
-- Gary''s Student - gsnu200835 "Alojz" wrote: Gary, it works well, yet I consider it a bit dangerous as u cannot make undo when accidentally double click... "Gary''s Student" wrote: How about a double-click?? Insert the following event macro in the worksheet code area: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Cancel = True Target.Value = "X" End Sub Because it is worksheet code, it is very easy to install and automatic to use: 1. right-click the tab name near the bottom of the Excel window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you have any concerns, first try it on a trial worksheet. If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200835 "rwfster" wrote: Is there any way to place an "X" in any cell of my choosiing by clicking on it or by touching the cell with a stylus from a touch screen tablet? -- rwfster |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If the cell range is constant then I'd go with checkboxes from the Forms
toolbar and forget the "X". If the number of cells are many and/or change then this can become a maintenance nightmare. If so, then this has only one rectangle to manage: 1. Put a rectangle on the worksheet 2. Adjust its size and position so that it just covers the desired cell range 3. Make it invisible by formatting its fill and line properties to No Fill and No Line respectively 4. Paste the following code to a standard code module 5. Assign the TogX macro to the rectangle Private Declare Function GetCursorPos Lib "user32.dll" ( _ ByRef lpPoint As POINTAPI) As Long Private Type POINTAPI x As Long y As Long End Type Sub TogX() Dim c As Range Dim cp As POINTAPI GetCursorPos cp With ActiveSheet .Unprotect 'optional With .Shapes(Application.Caller) .Visible = False Set c = ActiveWindow.RangeFromPoint(cp.x, cp.y) .Visible = True End With If c.Value = "X" Then c.Value = "" Else c.Value = "X" .Protect 'optional End With Set c = Nothing End Sub Regards Greg |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Feb 28, 8:16*pm, rwfster wrote:
Is there any way to place an "X" in any cell of my choosiing by clicking on it or by touching the cell with a stylus from a touch screen tablet? -- rwfster Try this for toggling: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.EnableEvents = False If StrComp(Target.Text, "X", vbTextCompare) = 0 Then Target.Value = "" Else Target.Value = "X" End If Application.EnableEvents = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION | Excel Discussion (Misc queries) | |||
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) |