+ Reply to Thread
Results 1 to 3 of 3

Assign a Macro to a Cell Input

  1. #1
    Registered User
    Join Date
    02-10-2005
    Posts
    10

    Assign a Macro to a Cell Input

    Hi,

    I have a cell A1 that has a model input that affects hundreds of other cells and I have a macro currently assigned to a button that copys and pastes some cells somewhere to refresh some of the data. I want to make it so that everytime the user either selects A1 or inputs a new number in A1 the macro automatically runs rather than having to remember to click the button. Ive tried assigning it to an autoshape hidden over the cell, but then it doesnt allow me to input anything into the cell because when i click it selects the autoshape rather than the cell.

    Please let me know if you guys know of any way to do this and thank you in advance

    Tim

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Tim,

    You need to use the Worksheet Change Event. You can test if the currently selected cell is "A1" and if so, excute your macro.
    _________________________________________________________________

    Example:

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    If Target.Address = "$A$1" Then
    Call MyMacro
    End If

    End Sub

    _________________________________________________________________

    Contact me if you have any questions,
    Leith Ross

  3. #3
    Registered User
    Join Date
    02-10-2005
    Posts
    10
    Thank you Very much Leith. Your solution worked like a dream..... it was exactly what I was looking for.

    Tim

+ 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