Consulting

Results 1 to 7 of 7

Thread: Solved: Displaying symbols programmatically

  1. #1

    Solved: Displaying symbols programmatically

    Hiyas

    I am trying to print a 'tick'/'check' symbol in a particular column of an Excel document if a condition is satisfied. How do I go about doing this programmatically? I think I must have to do something with the font and or charset or something but beyond that I'm clueless.

    For regular I just use:

    [vba].Cells(row, col)= Value[/vba]
    Currently the only font settings etc are these:

    [vba]xl.Cells.select
    xl.selection.Font.Name = "Verdana"
    xl.selection.Font.Size = 9
    xl.Rows("1:1").Select
    xl.Selection.Font.Bold = True
    xl.selection.Font.size = 10
    xl.selection.RowHeight = 15
    xl.Cells.select
    xl.selection.columnwidth = 100
    xl.selection.columns.Autofit
    xl.selection.rows.Autofit
    xl.selection.VerticalAlignment = xlTop
    xl.ActiveSheet.Range("A1").Select[/vba]
    What changes do I need to make to be able to print a tick/check to an Excel cell?

    Thanks in advance.

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location

    a checkmark

    Quote Originally Posted by muttleee
    Hiyas

    I am trying to print a 'tick'/'check' symbol in a particular column of an Excel document if a condition is satisfied. How do I go about doing this programmatically? I think I must have to do something with the font and or charset or something but beyond that I'm clueless.

    For regular I just use:

    [vba].Cells(row, col)= Value[/vba]
    Currently the only font settings etc are these:

    [vba]xl.Cells.select
    xl.selection.Font.Name = "Verdana"
    xl.selection.Font.Size = 9
    xl.Rows("1:1").Select
    xl.Selection.Font.Bold = True
    xl.selection.Font.size = 10
    xl.selection.RowHeight = 15
    xl.Cells.select
    xl.selection.columnwidth = 100
    xl.selection.columns.Autofit
    xl.selection.rows.Autofit
    xl.selection.VerticalAlignment = xlTop
    xl.ActiveSheet.Range("A1").Select[/vba]
    What changes do I need to make to be able to print a tick/check to an Excel cell?

    Thanks in advance.
    Maybe you can use the Marlett font. When you put the letter a in the cel a V appears in the cel.

    Look at this KB article http://www.vbaexpress.com/kb/getarticle.php?kb_id=550

    Charlize
    Last edited by Charlize; 09-28-2006 at 05:45 AM.

  3. #3
    Thanks for the link - looks promising. :-)

  4. #4
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Another way without Marlett font but with Symbol font. Use the squareroot symbol. Place this in the sheet module.
    [vba]
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 1 And Target.Row > 1 Then
    ActiveCell.Font.Name = "Symbol"
    ActiveCell.Font.Size = 10
    ActiveCell.FormulaR1C1 = "?"
    Cancel = True
    Else
    MsgBox ("Only column 1 and row > 1")
    Cancel = True
    End If
    End Sub
    [/vba]
    Charlize

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    You could always show the character map programmatically as well..

    http://vbaexpress.com/kb/getarticle.php?kb_id=784

    HTH

  6. #6
    I'm not sure I understand what you mean by a 'tick' mark, but I use 'check' marks a lot by entering an uppercase "P" and use the "Wingdings 2" font. Here's a little utility that I use. This utility requires that you click on the cell where you want the check mark, then execute the macro (which I do with a button):
    [vba]Sub InsertCheckMark() '7/23/02
    'Inserts a check mark into the selected cell
    With ActiveCell
    .Value = "P"
    .VerticalAlignment = xlTop
    .HorizontalAlignment = xlCenter
    .Interior.ColorIndex = White
    With .Font
    .Name = "WingDings 2"
    .ColorIndex = Black
    .Size = 12
    .Bold = False
    End With
    End With
    End Sub[/vba] Try it . . . you'll like it!

  7. #7
    Thanks for all the help - I've got it working ok now. I used the Marlett font to write the letter 'a' to the document and that showed up as a 'tick' (or check mark for the Americans out there).

    Must have a look at the Wing Ding thing for curiosity's sake...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •