+ Reply to Thread
Results 1 to 6 of 6

Macro to Create Button and assign code

Hybrid View

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Macro to Create Button and assign code

    Quote Originally Posted by davesexcel View Post
    Hi Bruce,
    Very impressive,
    how can you set the range for the button, say next to the active cell??
    I know it's 8 years too late but in case other users are looking for the same answer:

    Dim sShape As Shape
        With Range("A1")
            Set sShape = ActiveSheet.Shapes.AddFormControl _
            (Type:=xlButtonControl, Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
        End With
        With sShape
            .OnAction = "YOURMACROHERE"
            With .TextFrame.Characters
                .Caption = "BUTTON TEXT"
                With .Font
                    .name = "Arial"
                    .FontStyle = "Regular"
                    .Size = 12
                End With
            End With
        End With
    Last edited by maxim123123; 02-06-2014 at 12:21 PM. Reason: added code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1