PC Review


Reply
Thread Tools Rate Thread

Add check mark to cell upon selection

 
 
RVS
Guest
Posts: n/a
 
      10th Jul 2009
Hello All!

I am trying to write code that will add a check mark to any cell in Column A
upon selection. Here is what I've written, but I cannot get it to work.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub

If Not Intersect(Target, Range("A2:A100")) Is Nothing Then

Target.Font.Name = "Marlett"

If Target = vbNullString Then

Target = "a"

Else

Target = vbNullString

End If

End If

End Sub

Any thoughts on why this is not working?
Thanks in advance!
 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      10th Jul 2009
Format your cells as 'Wingdings 2' and put this event code behind the SHEET
(not in a Module):

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Not Intersect(Target, Range("A1:AZ100")) Is Nothing Then
If Target = "P" Then
Target = vbNullString
ElseIf Target = vbNullString Then
Target = "P"
Else
End If
End If
End Sub


HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"RVS" wrote:

> Hello All!
>
> I am trying to write code that will add a check mark to any cell in Column A
> upon selection. Here is what I've written, but I cannot get it to work.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> If Target.Cells.Count > 1 Then Exit Sub
>
> If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
>
> Target.Font.Name = "Marlett"
>
> If Target = vbNullString Then
>
> Target = "a"
>
> Else
>
> Target = vbNullString
>
> End If
>
> End If
>
> End Sub
>
> Any thoughts on why this is not working?
> Thanks in advance!

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      11th Jul 2009
"RVS" try the below

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
If Target.Count = 1 Then
Target.Font.Name = "Marlett"
Target.Value = IIf(Target.Value = "r", "e", "r")
'Target.Value = IIf(Target.Value = "a", "e", "a") 'For tick mark
End If
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"RVS" wrote:

> Hello All!
>
> I am trying to write code that will add a check mark to any cell in Column A
> upon selection. Here is what I've written, but I cannot get it to work.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> If Target.Cells.Count > 1 Then Exit Sub
>
> If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
>
> Target.Font.Name = "Marlett"
>
> If Target = vbNullString Then
>
> Target = "a"
>
> Else
>
> Target = vbNullString
>
> End If
>
> End If
>
> End Sub
>
> Any thoughts on why this is not working?
> Thanks in advance!

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      11th Jul 2009
Missed to mention ...You can create a visual impact of check box by doing the
below along with your code..

1. Enter small letter "e" in all the cells (A2:A100)
2. Select all cells in that range (A2:a100) and change the font to Marlett.
3. Adjust the column width to look like a square check box

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

> "RVS" try the below
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
> If Target.Count = 1 Then
> Target.Font.Name = "Marlett"
> Target.Value = IIf(Target.Value = "r", "e", "r")
> 'Target.Value = IIf(Target.Value = "a", "e", "a") 'For tick mark
> End If
> End If
> End Sub
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "RVS" wrote:
>
> > Hello All!
> >
> > I am trying to write code that will add a check mark to any cell in Column A
> > upon selection. Here is what I've written, but I cannot get it to work.
> >
> > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> > If Target.Cells.Count > 1 Then Exit Sub
> >
> > If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
> >
> > Target.Font.Name = "Marlett"
> >
> > If Target = vbNullString Then
> >
> > Target = "a"
> >
> > Else
> >
> > Target = vbNullString
> >
> > End If
> >
> > End If
> >
> > End Sub
> >
> > Any thoughts on why this is not working?
> > Thanks in advance!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check Mark in a cell Wally Microsoft Excel Worksheet Functions 1 19th Jan 2009 01:50 AM
Cannot check the check mark box in cell ac Microsoft Excel Worksheet Functions 1 15th Feb 2008 10:24 PM
How do you replace a yes value in a cell with a check mark? =?Utf-8?B?Rmxv?= Microsoft Excel Misc 5 26th Jun 2007 09:29 AM
command for using a check mark in a cell, not a check box =?Utf-8?B?aGFycmVsc29u?= Microsoft Access 1 16th Jan 2004 11:53 AM
inserting check-mark in a cell melody Microsoft Excel Misc 2 16th Sep 2003 07:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:33 PM.