+ Reply to Thread
Results 1 to 11 of 11

Code to color selected cells not working

  1. #1
    Registered User
    Join Date
    01-17-2019
    Location
    Omaha, Nebraska
    MS-Off Ver
    2016
    Posts
    5

    Code to color selected cells not working

    Code:
    Please Login or Register  to view this content.
    For some reason, if the first cell in each section is highlighted, it's highlighting the entire section until the next merged row. If the first row isn't highlighted, then none of the rows are highlighted. I have no earthly idea what I'm doing wrong. Thoughts?

  2. #2
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Code to color selected cells not working

    Hiya, do you have an example workbook you could upload, without any sensitive data?

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Code to color selected cells not working

    Firstly, it would help to see your entire code.
    Secondly, as mentioned a sample workbook makes things a lot easier.
    Lastly, NEVER used merged cells, they are an abomination & should be avoided like the plague!

  4. #4
    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,443

    Re: Code to color selected cells not working

    Works for me

    Please Login or Register  to view this content.

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    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


  5. #5
    Registered User
    Join Date
    01-17-2019
    Location
    Omaha, Nebraska
    MS-Off Ver
    2016
    Posts
    5

    Re: Code to color selected cells not working

    I'd love not to, but this is a report for my boss and he says use merged cells, so I use merged cells. :-|

  6. #6
    Registered User
    Join Date
    01-17-2019
    Location
    Omaha, Nebraska
    MS-Off Ver
    2016
    Posts
    5

    Re: Code to color selected cells not working

    Quote Originally Posted by Poizhan View Post
    Hiya, do you have an example workbook you could upload, without any sensitive data?
    Unfortunately, no. This is a work project and I have a signed NDA.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Code to color selected cells not working

    I'd love not to, but this is a report for my boss and he says use merged cells, so I use merged cells. :-|
    Fair enough.

  8. #8
    Registered User
    Join Date
    01-17-2019
    Location
    Omaha, Nebraska
    MS-Off Ver
    2016
    Posts
    5

    Re: Code to color selected cells not working

    Quote Originally Posted by TMS View Post
    Works for me
    Which version of Excel are you using? Maybe it's just a bug with the one I'm running. I'm beta testing 2016 at work.

  9. #9
    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,443

    Re: Code to color selected cells not working

    I have a Microsoft Office 365 Subscription, so, whatever that is ... think it's 2016

  10. #10
    Registered User
    Join Date
    01-17-2019
    Location
    Omaha, Nebraska
    MS-Off Ver
    2016
    Posts
    5

    Re: Code to color selected cells not working

    Quote Originally Posted by TMS View Post
    I have a Microsoft Office 365 Subscription, so, whatever that is ... think it's 2016
    It's 2019. Maybe it's a bug with 2016. The code doesn't run properly in 2010 either. I've tried re-writing it about 6 different ways and it just does the same thing every time.

  11. #11
    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,443

    Re: Code to color selected cells not working

    It's 2019
    If you say so, I just apply whatever updates I get.


    Can you not upload a sample that includes the layout and some dummy data that reflects the problem?

    Otherwise, I think you're on your own. With the best wish in the world, we can't second guess the layout and content. We have no idea which cells are merged and what data is contained in them ... or non-merged cells.

+ 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. VBA Code not working for color change
    By Protichi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2019, 12:32 AM
  2. VBA code for changing color of dots upon click not working as it once did
    By jenny1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2013, 03:38 PM
  3. Replies: 2
    Last Post: 03-15-2012, 12:11 AM
  4. Code to change color and value in calendar cells based on selected dates
    By John74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2010, 02:01 PM
  5. I cannot color mouse selected cells with a macro
    By dschmitt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2010, 12:53 AM
  6. Excel 2007 : Screen COLOR of Selected Cells
    By kldeal in forum Excel General
    Replies: 1
    Last Post: 04-22-2010, 11:09 AM
  7. [SOLVED] working with selected cells
    By Vishnu Prasad Ramachandran in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2006, 03:45 AM

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