+ Reply to Thread
Results 1 to 27 of 27

Highlight Dynamic Rows

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Highlight Dynamic Rows

    Hi All,

    I have an issue where I need to highlight all columns which have a SAT or SUN as date.

    I can do that ok, but if I insert a new row for another product everything is out of whack due to hard coding.

    But I don;t know where to start to address this issue.

    Can anybody steer me in the correct direction.

    I have attached a workbook as to what I have done so far.

    Thanks

    Lionel
    Last edited by Foreverlearning; 03-10-2012 at 06:49 PM.

  2. #2
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Highlight Dynamic Rows

    Perhaps this way. I have used Text function to arrive the day and used conditional formatting to highlight the holidays. See the attachment.
    Attached Files Attached Files
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  3. #3
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Hi johnjohns,

    Sorry no go as it hi-lights the whole column.
    In my example I had sections where the highlight did not extend too.
    I need the date section as date as it is read by another code source as well.

    I prefer a VBA solution

    Thanks
    Lionel

  4. #4
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Highlight Dynamic Rows

    You can select ranges and clear the conditional formatting from there. I would suggest to use excel's built in features if that helps. See the attachment. I have removed the text function also
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Sorry, but there is a larger issue to this as there are other factors involved here.

    Yes, inbuilt would be best, but when you are setting up for other users and the sheet gets used as a template amongst other issues
    it is not an option.

    Lionel

  6. #6
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Highlight Dynamic Rows

    Select the area under dates (exluding the rows you want to spare) and run the below macro

    Please Login or Register  to view this content.
    if your date is not in 5th row then chnage the below
    Please Login or Register  to view this content.
    to your requirement

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Highlight Dynamic Rows

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by snb; 03-05-2012 at 09:17 AM.



  8. #8
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Highlight Dynamic Rows

    That was a typical snb approach . Fewer codes and better solution! Adding to my learning

  9. #9
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Hi Fellas,

    Tried all three but, Oh! not really doing the job.

    Can I explain some more details.

    There will be rows inserted every now and then on a template when needed and the template is copied as a active sheet when required.
    A date will be entered at a fixed point but date range across columns are dynamic.

    The number of rows from the date cell varies (but same number for each column) a product number is a reference point on the left.

    I am trying to via VBA check by (column) date header(Date always in row 5) and if SAT or SUN and check each (ROW) if a product number highlight that cell.

    I have done repetitively for a fixed number of rows (messy though) but need dynamic based on product number which will have gaps in between.

    Thank You

    Lionel

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Highlight Dynamic Rows

    Tried all three but, Oh! not really doing the job.
    The code is doing the job you presented.

    Proper designing precedes coding.

  11. #11
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Ok, the codes did the job to your understanding, but my bad if it is not understood to my last post.

    Can you steer me in the right direction

    Thanks

    Lionel

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel
    I'm not certain I understand the issue but, based on my understanding, try this:
    In Sheet1 Module place this code
    Please Login or Register  to view this content.
    Replace your cmdSAT_SUN_Click code with this
    Please Login or Register  to view this content.
    See attached...let me know of issues.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  13. #13
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Hi jaslake,

    Glad you called in. Thank you for your interest.

    Basically you are on the right track, but as you see in worksheet there are rows which are grey or white in between the coloured cells.
    These are the cells I did't want to be coloured. They contain specific info which I wanted to be white.

    I hope I haven't confused everybody. But I will explain more if needed.

    Thanks mate.

    Lionel

  14. #14
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Hi jaslake,

    After re-examining your code and found it was doing what is suppose to, but based on Auto filter (not quite sure what on though)

    I thought I would upload a more exact version of my current file minus a lot of stuff so you can see what I am trying to explain.

    Thank you for your time and interest'

    Lionel

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel
    Please post a workbook that includes this
    Below that is various data reports
    I need to see what these rows are and if they follow your shading scheme. The code I posted depends on finding the last row that needs shading applied.

    One other thing
    there are rows which are grey or white in between the coloured cells
    I'm terribly color blind. I DO see the gray colored cells. If by white you mean NO COLOR then we're fine if you truly mean shaded white then I'm out of business...I don't see them.

  16. #16
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel
    I think I've got the Color thing figured out...it appears all cells are filled with white...unless they're not. Let me see your file with the various data reports below.

  17. #17
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Thank you jaslake again for your continued interest in helping me.
    Much appreciated..

    I have added as requested.

    Lionel
    Attached Files Attached Files

  18. #18
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel
    In your sample file Cell A275 says "Header 7". I need to find that row so, what does it say in the real world and does it ALWAYS say that?

  19. #19
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Hi jaslake,

    The real world header 7 is MEASUREMENTS and it is static.

    Lionel

  20. #20
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Also to mention,
    While the Header will always say MEASUREMENTS the cell address may not always be the same
    But always Column A though.

    Thanks
    Lionel
    Last edited by Foreverlearning; 03-09-2012 at 01:28 AM. Reason: Additional info

  21. #21
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel

    This code is in the attached:
    In 12-Mar Worksheet Module
    Please Login or Register  to view this content.
    In a General Module
    Please Login or Register  to view this content.
    Let me know of issues.
    Attached Files Attached Files

  22. #22
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Highlight Dynamic Rows

    Why is your alias foreverlearning ?

  23. #23
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    @snb
    BIG Smile...

  24. #24
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Highlight Dynamic Rows

    Hi jaslake,

    What can I say

    You are a legend mate.

    I will give it a whirl on my actual workbook later and post back.

    @snb
    at least I admit I am foreverlearning as you can never always know everything

    Thanks
    Lionel

  25. #25
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel
    Not a "legend"...simply looked for a connection. For your benefit, ALWAYS post a workbook that truly represents your ACTUAL file, down to the last format detail. Makes things easier to find connections and saves rewrites.

    snb is quite brilliant...well beyond my expertise and understanding...I got a rather large smile from his question...I too, with the Grace of God, am "Forever Learning".

  26. #26
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Thumbs up Re: Highlight Dynamic Rows

    Hi jaslake,

    Thanks for the tips.

    Thank you for persisting and finding a solution.

    I tried the code on my actual workbook and ran fine, except one hiccup.

    If I leave the template blank / uncoloured date cells, the whole column gets coloured to bottom used row when I copy the template and run code.
    But if I set up the SAT-SUN columns 1st all is good.

    Dissecting your code explained why...

    Regards
    Lionel

  27. #27
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Highlight Dynamic Rows

    Hi Lionel
    You're welcome...glad I could help.

+ 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