+ Reply to Thread
Results 1 to 5 of 5

Change Format of a cell when the row is selected

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    Virginia Beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Change Format of a cell when the row is selected

    I have a schedule spreadsheet with 8 columns and various rows (1-200). When the scheduler cancels one of the records, I've created a macro to change the font of the selected row to be Bold, Red, and Strikethrough. Now what i'm trying to accomplish is to not apply the Strikethrough format on Column D, and change the value to "N/A"

    The problem is that when I add the Selection.Cells lines, the code executed but seems to be in an endless loop and I have to end task. Before I added the last two lines, everything worked well.

    Any help to better work this issue is deeply appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Change Format of a cell when the row is selected

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Change Format of a cell when the row is selected

    Hi Ambassador777,

    1. Your 'for loop' is redundant. Your existing code processes the entire range once for each cell in the range.

    2. To process a single cell you would need something like:
    Please Login or Register  to view this content.
    3. Please note that it is poor programming practice to use potential Excel VBA KEYWORDS as variable names, e.g. 'row' and/or 'column' or 'cells'.


    4. The following code may explain what you need.
    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 10-07-2014 at 03:25 PM.

  4. #4
    Registered User
    Join Date
    05-16-2011
    Location
    Virginia Beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Change Format of a cell when the row is selected

    Works Great! Thanks for the speedy reply.

  5. #5
    Registered User
    Join Date
    05-16-2011
    Location
    Virginia Beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Change Format of a cell when the row is selected

    Good tip Lewis, I'll take that onboard. Thank you.

+ 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. [SOLVED] Change cells format when a value is selected
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 06:15 AM
  2. [SOLVED] Change cell value when selected
    By GaidenFocus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-27-2012, 03:34 PM
  3. Replies: 11
    Last Post: 08-31-2010, 01:30 PM
  4. change view format of selected cell
    By hopeace in forum Excel General
    Replies: 1
    Last Post: 10-13-2005, 08:05 PM
  5. Replies: 2
    Last Post: 04-06-2005, 01:06 PM

Tags for this Thread

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