+ Reply to Thread
Results 1 to 10 of 10

How to run a macro on different cells?

  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    los angeles, california
    MS-Off Ver
    Microsoft Excel for Mac 2011
    Posts
    5

    How to run a macro on different cells?

    Is there a way to click on a cell then click a button with an assign macro that would clear the contents in the corresponding row for the cell that was clicked? I want the same button to clear the contents in the row every time a cell is clicked followed by the click of the button.

    Thank you,
    Areli

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,605

    Re: How to run a macro on different cells?

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,605

    Re: How to run a macro on different cells?

    Thanks for the rep. Solved?

  4. #4
    Registered User
    Join Date
    06-12-2012
    Location
    los angeles, california
    MS-Off Ver
    Microsoft Excel for Mac 2011
    Posts
    5

    Re: How to run a macro on different cells?

    Yes thank you very much. Now I want to tweak it a little, instead of clearing the entire row, I want to clear only some of the cells in that corresponding row. How can I go about that?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,605

    Re: How to run a macro on different cells?

    Which columns?

  6. #6
    Registered User
    Join Date
    06-12-2012
    Location
    los angeles, california
    MS-Off Ver
    Microsoft Excel for Mac 2011
    Posts
    5

    Re: How to run a macro on different cells?

    Column F,N,O and P

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,605

    Re: How to run a macro on different cells?

    Please Login or Register  to view this content.

    Regards, TMS

  8. #8
    Registered User
    Join Date
    06-12-2012
    Location
    los angeles, california
    MS-Off Ver
    Microsoft Excel for Mac 2011
    Posts
    5

    Re: How to run a macro on different cells?

    That works! But can you please explain me a little of how the code works?

    Thank you soo much for your help.

  9. #9
    Registered User
    Join Date
    06-12-2012
    Location
    los angeles, california
    MS-Off Ver
    Microsoft Excel for Mac 2011
    Posts
    5

    Re: How to run a macro on different cells?

    Also, after running the macro, the cells that were cleared stay highlighted. How do I go back to the original active cell?

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,605

    Re: How to run a macro on different cells?

    The cells are never selected, just cleared ... so I don't know why that is happening for you.

    The Active Cell is not changed.

    The code determines the row number of the active cell. It then uses that with the column letters to clear the cells.

    If more than one cell is selected, the code will only clear the first row cells.

+ 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