+ Reply to Thread
Results 1 to 8 of 8

Run Macro in selected row

  1. #1
    Registered User
    Join Date
    03-18-2015
    Location
    Detroit
    MS-Off Ver
    2013
    Posts
    78

    Question Run Macro in selected row

    Hi I have a problem I have searched on but could not find.

    I have a spreadsheet where I want to format certain rows (which contain about 15 columns per row) only.

    For instance, I have 100 rows that are pre-formatted and I want to choose cell A-20, run the macro and make that entire row dark blue and large font, and I want certain cells to have the same text color as the blue background to hide the text in certain cells in the row.

    Then I want to do the same thing to row 30 my selecting A-30 and running the macro.
    I created the Macro by formatting a row on the sheet but obviousy no matter what cell or row I run it from It formats the row in the original Macro.

    I just need it to select the row that is active when I start the Macro.

    Using either the first cell in a row or the row selector would be fine.

    Here is my macro as-is

    Please Login or Register  to view this content.

    Thanks for any help

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Run Macro in selected row

    Just using your code:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    03-18-2015
    Location
    Detroit
    MS-Off Ver
    2013
    Posts
    78

    Re: Run Macro in selected row

    Thanks that works.
    Weird thing is the shortcut ctrl+j doesn't work anymore.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Run Macro in selected row

    You're welcome and thanks for the rep!


    You can set up the hot key and use it for an envelope:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-18-2015
    Location
    Detroit
    MS-Off Ver
    2013
    Posts
    78

    Re: Run Macro in selected row

    One more question on this. Is there a way we can lock this down so upon running the macro it first prompts to user to choose the starting cell of the row to be changed (like a:40 for example)? Because I am afraid people are going to forget where their mouse cursor is and they are going to start shredding this worksheet unintentionally. I did it myself twice already lol.



    Please Login or Register  to view this content.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Run Macro in selected row

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-18-2015
    Location
    Detroit
    MS-Off Ver
    2013
    Posts
    78

    Re: Run Macro in selected row

    Worked like a charm!
    Thanks a ton!

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Run Macro in selected row

    Welcome a ton

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro/VBA Code that will trigger Macro for next tab selected:
    By Chad Bateman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2015, 01:56 AM
  2. create a macro that will perform another macro on selected cells
    By JMJ123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2013, 12:44 AM
  3. Replies: 2
    Last Post: 08-28-2011, 02:39 AM
  4. Macro to delete selected row
    By adsm in forum Access Tables & Databases
    Replies: 0
    Last Post: 08-19-2010, 06:04 PM
  5. Run Macro for selected data
    By notaguru6 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2010, 02:17 PM
  6. run macro when cell is selected
    By beauty_bobaloo in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-30-2006, 07:15 PM
  7. Macro to take selected cells times a selected cell
    By Craig in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2005, 08:05 PM

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