Consulting

Results 1 to 4 of 4

Thread: macro help

  1. #1
    VBAX Tutor
    Joined
    Dec 2009
    Posts
    295
    Location

    macro help

    hi
    i am trying to use this macro
    in excel:

    [VBA]Private Sub O6_Click()
    Selection.Font.Name = "ARIAL"
    Selection.Font.Size = 12
    Selection.TypeText Text:="6"
    End Sub[/VBA]

    it gives me:

    object does not support this proporty or method

    what can i do to fix this??


    TNX

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location

    Arrow

    Selection can be anything, a shape or a range etc.

    Were you thinking ActiveCell.Font. etc.?

    That would apply your macro to the currently selected cell


    Your could use

    [VBA]
    If Not TypeOf Selection Is Range Then Exit Sub
    [/VBA]

    Paul

  3. #3
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    The TypeText is a Word Method, not an Excel method.

    Selection = "6" does the same thing.

  4. #4
    VBAX Tutor
    Joined
    Dec 2009
    Posts
    295
    Location
    HI
    IT WORKS
    BUT I HAVE A USRFORM WITH BUTTONS IN THE WORD WHEN I CLICK EACH BUTTON IT WRITES ME A LETTER WHEN I CLICK ATHER BOTTUN IT WRITES ME A LETTER NEXT TO IT KNOW IN EXCEL EACH NEW CLICK REPLACES ME THE OLD ONE


    WHAT CAN I DO?

Posting Permissions

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