Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rick
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?

how can I make an excel cell "mark" or "unmark" when clicked on?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?

One way

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = "a" Then
.Value = ""
Else
.Value = "a"
End If
.Font.Name = "Marlett"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rick" wrote in message
...
how can I make an excel cell "mark" or "unmark" when clicked on?



  #3   Report Post  
Posted to microsoft.public.excel.misc
mevetts
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?


Rick Wrote:
how can I make an excel cell "mark" or "unmark" when clicked on?


Contained in this worksheet's code module
It detects a click in columns D or E and then inserts a tick mark. It
then moves to column G in the same row. Clicking on a tick, removes it
and moves you to column G

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iOffset As Integer
On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Columns("D:E")) Is Nothing Then
If Target.Column = 4 Then
iOffset = 3
Else
iOffset = 2
End If
If IsEmpty(Target.Value) Then
With Target
.Font.Name = "Wingdings"
.Value = Chr(252)
End With
Target.Offset(0, iOffset).Select
Else
Target.Value = ""
Target.Offset(0, iOffset).Select
End If
End If
err_handler:
Application.EnableEvents = True
End Sub


--
mevetts


------------------------------------------------------------------------
mevetts's Profile: http://www.excelforum.com/member.php...o&userid=29130
View this thread: http://www.excelforum.com/showthread...hreadid=499083

  #4   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?

Hi Rick

In addition to the method already posted, you could use something like
the following.

Private Sub AddCheckBoxes()
Dim c As Range, myRange As Range
Set myRange = Selection

For Each c In myRange.Cells
ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width,
c.Height).Select
With Selection
.LinkedCell = c.Address
.Characters.Text = ""
End With
With Selection.Font
.ColorIndex = 2
End With
Next
myRange.Select

End Sub

The ColorIndex part is just setting the font to be White, so that you
don't see the word TRUE when you select the click box.
The value of the underlying cell will be set to True when clciked, and
False when unclicked.


--
Regards

Roger Govier


"Rick" wrote in message
...
how can I make an excel cell "mark" or "unmark" when clicked on?



  #5   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?

mevetts wrote

With Target
Font.Name = "Wingdings"
Value = Chr(252)
End With


Just a FYI,
Doesn't happen w/o periods before Font and Value:
With Target
..Font.Name = "Wingdings"
..Value = Chr(252)
End With

--
David


  #6   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?

I think you might find that is a result of the uploading from ExcelForum to
the NG, not the poster. Have seen it many times.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"David" wrote in message
...
mevetts wrote

With Target
Font.Name = "Wingdings"
Value = Chr(252)
End With


Just a FYI,
Doesn't happen w/o periods before Font and Value:
With Target
.Font.Name = "Wingdings"
.Value = Chr(252)
End With

--
David



  #7   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default how can I make an excel cell "mark" or "unmark" when clicked on?

Bob Phillips wrote

I think you might find that is a result of the uploading from
ExcelForum to the NG, not the poster. Have seen it many times.


Point taken.

--
David
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 2003 Word Wrap Problem within cell Dan S. Excel Discussion (Misc queries) 1 October 17th 05 03:54 PM
how do I make a cell in Excel required to be populated? Tia Excel Discussion (Misc queries) 1 February 10th 05 12:35 AM
How Can I make a cell flash in Excel monir Excel Discussion (Misc queries) 0 February 4th 05 03:41 AM
make a cell empty based on condition mpierre Charts and Charting in Excel 2 December 29th 04 01:01 PM
make cell contents equal to null value - not blank, but empty mpierre Excel Worksheet Functions 1 December 29th 04 06:57 AM


All times are GMT +1. The time now is 04:00 AM.

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

About Us

"It's about Microsoft Excel"