+ Reply to Thread
Results 1 to 4 of 4

Excel macro works with keyboard shortcut, but not command button. Please Help.

  1. #1

    Excel macro works with keyboard shortcut, but not command button. Please Help.

    I have constructed a macro in excel and when I execute it using the
    keyboard shortcut from Sheet X it runs fine, but after I created a
    command button and assigned the macro to it the macro no longer works
    when clicking on the button. When I click the keyboard shortcut it
    works, exact same macro programmed for command button doesn't work.
    Any ideas? The macro language is below. Thanks in advance, any help
    is appreciated! Michael

    Sub POST_TO_BLOTTER_Click()
    '
    ' ORDERS Macro
    ' Macro recorded 4/28/2006 by mneches
    '
    ' Keyboard Shortcut: Ctrl o

    Sheets("BLOTTER").Select
    Dim Rng As Range
    For Each Rng In Range("d3:d100") '
    Rng.EntireRow.Cells(1, Columns.Count). _
    End(xlToLeft)(1, 2).Value = Rng.Value
    Next Rng
    Application.CutCopyMode = False
    Sheets("Sectors").Select
    End Sub


  2. #2
    Don Guillett
    Guest

    Re: Excel macro works with keyboard shortcut, but not command button. Please Help.

    try setting focus to false or assign to a button or shape from the forms or
    drawing toolbars

    --
    Don Guillett
    SalesAid Software
    [email protected]
    <[email protected]> wrote in message
    news:[email protected]...
    >I have constructed a macro in excel and when I execute it using the
    > keyboard shortcut from Sheet X it runs fine, but after I created a
    > command button and assigned the macro to it the macro no longer works
    > when clicking on the button. When I click the keyboard shortcut it
    > works, exact same macro programmed for command button doesn't work.
    > Any ideas? The macro language is below. Thanks in advance, any help
    > is appreciated! Michael
    >
    > Sub POST_TO_BLOTTER_Click()
    > '
    > ' ORDERS Macro
    > ' Macro recorded 4/28/2006 by mneches
    > '
    > ' Keyboard Shortcut: Ctrl o
    >
    > Sheets("BLOTTER").Select
    > Dim Rng As Range
    > For Each Rng In Range("d3:d100") '
    > Rng.EntireRow.Cells(1, Columns.Count). _
    > End(xlToLeft)(1, 2).Value = Rng.Value
    > Next Rng
    > Application.CutCopyMode = False
    > Sheets("Sectors").Select
    > End Sub
    >




  3. #3

    Re: Excel macro works with keyboard shortcut, but not command button. Please Help.

    That did it! Thanks! For my information, what's the difference
    between the command button and the regular button?


  4. #4
    Don Guillett
    Guest

    Re: Excel macro works with keyboard shortcut, but not command button. Please Help.

    Command button is too much hassle. I haven't used one in years. I usually
    use a shape from the drawing toolbar.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    <[email protected]> wrote in message
    news:[email protected]...
    > That did it! Thanks! For my information, what's the difference
    > between the command button and the regular button?
    >




+ 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