PC Review


Reply
Thread Tools Rate Thread

Code to insert check mark

 
 
jmcclain
Guest
Posts: n/a
 
      13th Mar 2008
I found the following code in a post from 2005. I tried to follow the
instructions. I pasted the code in the view code and exited back to EXCEL.

i am trying to allow a user to click column D, E, and F and have EXCEL
automatically insert a check mark.

Am I on the right track? Can someone outline the process to "activate" this
code so it will work?

Thanks again

Jon
 
Reply With Quote
 
 
 
 
jmcclain
Guest
Posts: n/a
 
      13th Mar 2008
Sorry, here is the code.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 1 Then
If Len(Trim(Target.Value)) = 0 Then
Target.Value = Chr(252)
Target.Font.Name = "Wingdings"
Target.Font.Size = 10
Else
Target.ClearContents
End If
End If
End Sub

"jmcclain" wrote:

> I found the following code in a post from 2005. I tried to follow the
> instructions. I pasted the code in the view code and exited back to EXCEL.
>
> i am trying to allow a user to click column D, E, and F and have EXCEL
> automatically insert a check mark.
>
> Am I on the right track? Can someone outline the process to "activate" this
> code so it will work?
>
> Thanks again
>
> Jon

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      13th Mar 2008
Try this alternative


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "D:E" '<=== change to suit

On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
With Target
.Font.Name = "Marlett"
Select Case .Value
Case "": .Value = "a"
Case "a": .Value = ""
End Select
me.cells(.row,"C").select
End With
End If
err_handler:
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

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"jmcclain" <(E-Mail Removed)> wrote in message
news:88783DCB-E257-458D-9381-(E-Mail Removed)...
> Sorry, here is the code.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> If Target.Count > 1 Then Exit Sub
> If Target.Column = 1 Then
> If Len(Trim(Target.Value)) = 0 Then
> Target.Value = Chr(252)
> Target.Font.Name = "Wingdings"
> Target.Font.Size = 10
> Else
> Target.ClearContents
> End If
> End If
> End Sub
>
> "jmcclain" wrote:
>
>> I found the following code in a post from 2005. I tried to follow the
>> instructions. I pasted the code in the view code and exited back to
>> EXCEL.
>>
>> i am trying to allow a user to click column D, E, and F and have EXCEL
>> automatically insert a check mark.
>>
>> Am I on the right track? Can someone outline the process to "activate"
>> this
>> code so it will work?
>>
>> Thanks again
>>
>> Jon



 
Reply With Quote
 
jmcclain
Guest
Posts: n/a
 
      13th Mar 2008
Thanks Bob,

I have pasted it worksheet code module. Does it have to be someone
"activated"?

I changed the column range to D:F, but nothing happens when I click cell D4.

Can you help?

Thanks

"Bob Phillips" wrote:

> Try this alternative
>
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> Const WS_RANGE As String = "D:E" '<=== change to suit
>
> On Error GoTo err_handler
> Application.EnableEvents = False
> If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
> With Target
> .Font.Name = "Marlett"
> Select Case .Value
> Case "": .Value = "a"
> Case "a": .Value = ""
> End Select
> me.cells(.row,"C").select
> End With
> End If
> err_handler:
> 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
>
> Bob
>
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
>
>
> "jmcclain" <(E-Mail Removed)> wrote in message
> news:88783DCB-E257-458D-9381-(E-Mail Removed)...
> > Sorry, here is the code.
> >
> > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> > If Target.Count > 1 Then Exit Sub
> > If Target.Column = 1 Then
> > If Len(Trim(Target.Value)) = 0 Then
> > Target.Value = Chr(252)
> > Target.Font.Name = "Wingdings"
> > Target.Font.Size = 10
> > Else
> > Target.ClearContents
> > End If
> > End If
> > End Sub
> >
> > "jmcclain" wrote:
> >
> >> I found the following code in a post from 2005. I tried to follow the
> >> instructions. I pasted the code in the view code and exited back to
> >> EXCEL.
> >>
> >> i am trying to allow a user to click column D, E, and F and have EXCEL
> >> automatically insert a check mark.
> >>
> >> Am I on the right track? Can someone outline the process to "activate"
> >> this
> >> code so it will work?
> >>
> >> Thanks again
> >>
> >> Jon

>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      13th Mar 2008
No activation is required, it runs fine in those columns if you paste into
the worksheet code module.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"jmcclain" <(E-Mail Removed)> wrote in message
news:88659158-DD55-4638-A4E5-(E-Mail Removed)...
> Thanks Bob,
>
> I have pasted it worksheet code module. Does it have to be someone
> "activated"?
>
> I changed the column range to D:F, but nothing happens when I click cell
> D4.
>
> Can you help?
>
> Thanks
>
> "Bob Phillips" wrote:
>
>> Try this alternative
>>
>>
>> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>> Const WS_RANGE As String = "D:E" '<=== change to suit
>>
>> On Error GoTo err_handler
>> Application.EnableEvents = False
>> If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
>> With Target
>> .Font.Name = "Marlett"
>> Select Case .Value
>> Case "": .Value = "a"
>> Case "a": .Value = ""
>> End Select
>> me.cells(.row,"C").select
>> End With
>> End If
>> err_handler:
>> 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
>>
>> Bob
>>
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my
>> addy)
>>
>>
>>
>> "jmcclain" <(E-Mail Removed)> wrote in message
>> news:88783DCB-E257-458D-9381-(E-Mail Removed)...
>> > Sorry, here is the code.
>> >
>> > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
>> > If Target.Count > 1 Then Exit Sub
>> > If Target.Column = 1 Then
>> > If Len(Trim(Target.Value)) = 0 Then
>> > Target.Value = Chr(252)
>> > Target.Font.Name = "Wingdings"
>> > Target.Font.Size = 10
>> > Else
>> > Target.ClearContents
>> > End If
>> > End If
>> > End Sub
>> >
>> > "jmcclain" wrote:
>> >
>> >> I found the following code in a post from 2005. I tried to follow the
>> >> instructions. I pasted the code in the view code and exited back to
>> >> EXCEL.
>> >>
>> >> i am trying to allow a user to click column D, E, and F and have EXCEL
>> >> automatically insert a check mark.
>> >>
>> >> Am I on the right track? Can someone outline the process to
>> >> "activate"
>> >> this
>> >> code so it will work?
>> >>
>> >> Thanks again
>> >>
>> >> Jon

>>
>>
>>



 
Reply With Quote
 
jmcclain
Guest
Posts: n/a
 
      13th Mar 2008
Bob,

Thanks - got it to work. Had to exit and re-open the file.

Is there a way to "format" the check mark. Center it? Make it bigger? Bold?

Agains...thanks

"Bob Phillips" wrote:

> No activation is required, it runs fine in those columns if you paste into
> the worksheet code module.
>
> --
> ---
> HTH
>
> Bob
>
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
>
>
> "jmcclain" <(E-Mail Removed)> wrote in message
> news:88659158-DD55-4638-A4E5-(E-Mail Removed)...
> > Thanks Bob,
> >
> > I have pasted it worksheet code module. Does it have to be someone
> > "activated"?
> >
> > I changed the column range to D:F, but nothing happens when I click cell
> > D4.
> >
> > Can you help?
> >
> > Thanks
> >
> > "Bob Phillips" wrote:
> >
> >> Try this alternative
> >>
> >>
> >> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> >> Const WS_RANGE As String = "D:E" '<=== change to suit
> >>
> >> On Error GoTo err_handler
> >> Application.EnableEvents = False
> >> If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
> >> With Target
> >> .Font.Name = "Marlett"
> >> Select Case .Value
> >> Case "": .Value = "a"
> >> Case "a": .Value = ""
> >> End Select
> >> me.cells(.row,"C").select
> >> End With
> >> End If
> >> err_handler:
> >> 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
> >>
> >> Bob
> >>
> >>
> >> (there's no email, no snail mail, but somewhere should be gmail in my
> >> addy)
> >>
> >>
> >>
> >> "jmcclain" <(E-Mail Removed)> wrote in message
> >> news:88783DCB-E257-458D-9381-(E-Mail Removed)...
> >> > Sorry, here is the code.
> >> >
> >> > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> >> > If Target.Count > 1 Then Exit Sub
> >> > If Target.Column = 1 Then
> >> > If Len(Trim(Target.Value)) = 0 Then
> >> > Target.Value = Chr(252)
> >> > Target.Font.Name = "Wingdings"
> >> > Target.Font.Size = 10
> >> > Else
> >> > Target.ClearContents
> >> > End If
> >> > End If
> >> > End Sub
> >> >
> >> > "jmcclain" wrote:
> >> >
> >> >> I found the following code in a post from 2005. I tried to follow the
> >> >> instructions. I pasted the code in the view code and exited back to
> >> >> EXCEL.
> >> >>
> >> >> i am trying to allow a user to click column D, E, and F and have EXCEL
> >> >> automatically insert a check mark.
> >> >>
> >> >> Am I on the right track? Can someone outline the process to
> >> >> "activate"
> >> >> this
> >> >> code so it will work?
> >> >>
> >> >> Thanks again
> >> >>
> >> >> Jon
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      13th Mar 2008
All 3.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "D:F" '<=== change to suit

On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
With Target
.Font.Name = "Marlett"
Select Case .Value
Case "": .Value = "a"
Case "a": .Value = ""
End Select
.HorizontalAlignment = xlCenter
.Font.Size = 14
.Font.Bold = True
Me.Cells(.Row, "C").Select
End With
End If
err_handler:
Application.EnableEvents = True
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"jmcclain" <(E-Mail Removed)> wrote in message
news:29491FD6-3502-4676-9CAD-(E-Mail Removed)...
> Bob,
>
> Thanks - got it to work. Had to exit and re-open the file.
>
> Is there a way to "format" the check mark. Center it? Make it bigger?
> Bold?
>
> Agains...thanks
>
> "Bob Phillips" wrote:
>
>> No activation is required, it runs fine in those columns if you paste
>> into
>> the worksheet code module.
>>
>> --
>> ---
>> HTH
>>
>> Bob
>>
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my
>> addy)
>>
>>
>>
>> "jmcclain" <(E-Mail Removed)> wrote in message
>> news:88659158-DD55-4638-A4E5-(E-Mail Removed)...
>> > Thanks Bob,
>> >
>> > I have pasted it worksheet code module. Does it have to be someone
>> > "activated"?
>> >
>> > I changed the column range to D:F, but nothing happens when I click
>> > cell
>> > D4.
>> >
>> > Can you help?
>> >
>> > Thanks
>> >
>> > "Bob Phillips" wrote:
>> >
>> >> Try this alternative
>> >>
>> >>
>> >> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>> >> Const WS_RANGE As String = "D:E" '<=== change to suit
>> >>
>> >> On Error GoTo err_handler
>> >> Application.EnableEvents = False
>> >> If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing
>> >> Then
>> >> With Target
>> >> .Font.Name = "Marlett"
>> >> Select Case .Value
>> >> Case "": .Value = "a"
>> >> Case "a": .Value = ""
>> >> End Select
>> >> me.cells(.row,"C").select
>> >> End With
>> >> End If
>> >> err_handler:
>> >> 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
>> >>
>> >> Bob
>> >>
>> >>
>> >> (there's no email, no snail mail, but somewhere should be gmail in my
>> >> addy)
>> >>
>> >>
>> >>
>> >> "jmcclain" <(E-Mail Removed)> wrote in message
>> >> news:88783DCB-E257-458D-9381-(E-Mail Removed)...
>> >> > Sorry, here is the code.
>> >> >
>> >> > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
>> >> > If Target.Count > 1 Then Exit Sub
>> >> > If Target.Column = 1 Then
>> >> > If Len(Trim(Target.Value)) = 0 Then
>> >> > Target.Value = Chr(252)
>> >> > Target.Font.Name = "Wingdings"
>> >> > Target.Font.Size = 10
>> >> > Else
>> >> > Target.ClearContents
>> >> > End If
>> >> > End If
>> >> > End Sub
>> >> >
>> >> > "jmcclain" wrote:
>> >> >
>> >> >> I found the following code in a post from 2005. I tried to follow
>> >> >> the
>> >> >> instructions. I pasted the code in the view code and exited back
>> >> >> to
>> >> >> EXCEL.
>> >> >>
>> >> >> i am trying to allow a user to click column D, E, and F and have
>> >> >> EXCEL
>> >> >> automatically insert a check mark.
>> >> >>
>> >> >> Am I on the right track? Can someone outline the process to
>> >> >> "activate"
>> >> >> this
>> >> >> code so it will work?
>> >> >>
>> >> >> Thanks again
>> >> >>
>> >> >> Jon
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
jmcclain
Guest
Posts: n/a
 
      13th Mar 2008
Thanks very much...it worked great

"Bob Phillips" wrote:

> All 3.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> Const WS_RANGE As String = "D:F" '<=== change to suit
>
> On Error GoTo err_handler
> Application.EnableEvents = False
> If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
> With Target
> .Font.Name = "Marlett"
> Select Case .Value
> Case "": .Value = "a"
> Case "a": .Value = ""
> End Select
> .HorizontalAlignment = xlCenter
> .Font.Size = 14
> .Font.Bold = True
> Me.Cells(.Row, "C").Select
> End With
> End If
> err_handler:
> Application.EnableEvents = True
> End Sub
>
>
> --
> ---
> HTH
>
> Bob
>
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
>
>
> "jmcclain" <(E-Mail Removed)> wrote in message
> news:29491FD6-3502-4676-9CAD-(E-Mail Removed)...
> > Bob,
> >
> > Thanks - got it to work. Had to exit and re-open the file.
> >
> > Is there a way to "format" the check mark. Center it? Make it bigger?
> > Bold?
> >
> > Agains...thanks
> >
> > "Bob Phillips" wrote:
> >
> >> No activation is required, it runs fine in those columns if you paste
> >> into
> >> the worksheet code module.
> >>
> >> --
> >> ---
> >> HTH
> >>
> >> Bob
> >>
> >>
> >> (there's no email, no snail mail, but somewhere should be gmail in my
> >> addy)
> >>
> >>
> >>
> >> "jmcclain" <(E-Mail Removed)> wrote in message
> >> news:88659158-DD55-4638-A4E5-(E-Mail Removed)...
> >> > Thanks Bob,
> >> >
> >> > I have pasted it worksheet code module. Does it have to be someone
> >> > "activated"?
> >> >
> >> > I changed the column range to D:F, but nothing happens when I click
> >> > cell
> >> > D4.
> >> >
> >> > Can you help?
> >> >
> >> > Thanks
> >> >
> >> > "Bob Phillips" wrote:
> >> >
> >> >> Try this alternative
> >> >>
> >> >>
> >> >> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> >> >> Const WS_RANGE As String = "D:E" '<=== change to suit
> >> >>
> >> >> On Error GoTo err_handler
> >> >> Application.EnableEvents = False
> >> >> If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing
> >> >> Then
> >> >> With Target
> >> >> .Font.Name = "Marlett"
> >> >> Select Case .Value
> >> >> Case "": .Value = "a"
> >> >> Case "a": .Value = ""
> >> >> End Select
> >> >> me.cells(.row,"C").select
> >> >> End With
> >> >> End If
> >> >> err_handler:
> >> >> 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
> >> >>
> >> >> Bob
> >> >>
> >> >>
> >> >> (there's no email, no snail mail, but somewhere should be gmail in my
> >> >> addy)
> >> >>
> >> >>
> >> >>
> >> >> "jmcclain" <(E-Mail Removed)> wrote in message
> >> >> news:88783DCB-E257-458D-9381-(E-Mail Removed)...
> >> >> > Sorry, here is the code.
> >> >> >
> >> >> > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> >> >> > If Target.Count > 1 Then Exit Sub
> >> >> > If Target.Column = 1 Then
> >> >> > If Len(Trim(Target.Value)) = 0 Then
> >> >> > Target.Value = Chr(252)
> >> >> > Target.Font.Name = "Wingdings"
> >> >> > Target.Font.Size = 10
> >> >> > Else
> >> >> > Target.ClearContents
> >> >> > End If
> >> >> > End If
> >> >> > End Sub
> >> >> >
> >> >> > "jmcclain" wrote:
> >> >> >
> >> >> >> I found the following code in a post from 2005. I tried to follow
> >> >> >> the
> >> >> >> instructions. I pasted the code in the view code and exited back
> >> >> >> to
> >> >> >> EXCEL.
> >> >> >>
> >> >> >> i am trying to allow a user to click column D, E, and F and have
> >> >> >> EXCEL
> >> >> >> automatically insert a check mark.
> >> >> >>
> >> >> >> Am I on the right track? Can someone outline the process to
> >> >> >> "activate"
> >> >> >> this
> >> >> >> code so it will work?
> >> >> >>
> >> >> >> Thanks again
> >> >> >>
> >> >> >> Jon
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

 
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
Insert check mark in a box in Word Lisa Microsoft Word Document Management 5 24th Jul 2009 01:26 PM
How do I insert a box for a check mark in a survey? babb267 Microsoft Word Document Management 1 11th Apr 2009 01:42 PM
How do I insert a check-mark or bullet dot? Maddog Microsoft Word Document Management 1 19th Mar 2008 11:48 PM
How do you insert a check mark? =?Utf-8?B?QWxlc2hh?= Microsoft Word Document Management 1 14th Feb 2005 07:04 PM
How do I insert a check mark into a cell? Mark Charleston Microsoft Excel Misc 2 11th Jul 2003 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:05 PM.