Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default placing an "X" in a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default placing an "X" in a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 161
Default placing an "X" in a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default placing an "X" in a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default placing an "X" in a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default placing an "X" in a cell

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION yossie6 Excel Discussion (Misc queries) 1 June 16th 08 12:16 PM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM


All times are GMT +1. The time now is 08:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"