Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Posts
    211
    Thanks
    32
    Thanked 0 Times in 0 Posts

    Macro within a cell (2002 Rel. 10)

    I have attached a file depicting what I want to accomplish. I want to be able to add a black dot in a cell after a name. I used to be able to create a simple macro and add a button to the tool bar to run the macro. Is that still possible? Even using a keyboard shortcut, I'm having trouble accomplishing what I want to do. I want to be able to type a name in a cell, space a couple of times, then run the macro by shortcut or tool bar button. Can I do this?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro within a cell (2002 Rel. 10)

    You can't run a macro while you are inserting or editing text in a cell. You can, however, run a macro after you've finished editing it, and you can assign a keyboard shortcut and/or toolbar button to this macro the usual way. Here is such a macro:
    <code>
    Sub InsertBullet()
    Dim n As Integer
    ActiveCell = ActiveCell & " l"
    n = Len(ActiveCell)
    ActiveCell.Characters(n, 1).Font.Name = "WingDings"
    End Sub</code>

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Posts
    211
    Thanks
    32
    Thanked 0 Times in 0 Posts

    Re: Macro within a cell (2002 Rel. 10)

    I can create the macro if I know what to type. I just don't understand all the terminology. Hence, I don't know how to assign the specific bullet I want in the macro. Or how to assign it to a tool bar button after I create it. Sorry for being so ignorant on this.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro within a cell (2002 Rel. 10)

    To create the macro:
    - Press Alt+F11 to activate the Visual Basic Editor.
    - If you see Personal.xls in the Project Explorer on the left, click on it (*).
    - Select Insert | Module.
    - Copy and paste the macro code from my previous reply into the window.

    Switch back to Excel using the Windows taskbar or by pressing Alt+F11 again.

    To assign a keyboard shortcut to the new macro:
    - Press Alt+F8 to open the Macros dialog.
    - Locate and select the macro in the list of available macros.
    - Click Options...
    - Click in the Shortcut key box.
    - You can press a letter, digit or punctuation character, by itself or in combination with the Shift key.
    - Click OK.

    To assign your macro to a custom toolbar button:
    - Select Tools | Customize...
    - Activate the Commands tab.
    - Select Macros in the list of Categories on the left.
    - Drag the Custom button (the smiley face) to a convenient location on a toolbar.
    - Excel will ask you to assign a macro. Select the macro that you just created.
    - You can right-click the new button to change its name (caption), picture etc.
    - Close the Customize dialog when you're done.

    (*) If you don't know what Personal.xls is, see Legare Coleman's <!post=Personal.xls Tutorial (All),118382>Personal.xls Tutorial (All)<!/post>.

Posting Permissions

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