+ Reply to Thread
Results 1 to 13 of 13

Highlight a range of cells to match the date

  1. #1
    Registered User
    Join Date
    07-08-2015
    Location
    Richmond, Virginia
    MS-Off Ver
    Office 13
    Posts
    37

    Highlight a range of cells to match the date

    I have a userform that opens when a persons name is double clicked. They enter a start date and an end date. My worksheet has every date entered across the top (from 8/01/2015 - 11/30/2016). I want to find a way to highlight the block of cells that someone enters into the userform, for example if someone in row 12 enters start: 8/03/2015 and end: 8/21/2015 in the userform then it will highlight every cell in say blue between those two dates in row 12. Can anyone help?

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    cmoore, can you upload a workbook we can work with?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    07-08-2015
    Location
    Richmond, Virginia
    MS-Off Ver
    Office 13
    Posts
    37

    Re: Highlight a range of cells to match the date

    I actually can't. Is there any way you can help without the workbook?

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    pretty tough... I have no idea how the book is structured, or how the form works now... I don't need real data, but if I don't know how it works now, then it is hard to duplicate your setup. can you maybe post the code for the form at least?

  5. #5
    Registered User
    Join Date
    07-08-2015
    Location
    Richmond, Virginia
    MS-Off Ver
    Office 13
    Posts
    37

    Re: Highlight a range of cells to match the date

    Private Sub cancelbutton_Click()

    Unload Me

    End Sub

    Private Sub clearbutton_Click()

    Call Userform_Initialize

    End Sub

    Private Sub eventbox_Change()

    End Sub

    Private Sub UserForm_Click()

    End Sub

    Private Sub savebutton_Click()

    Dim sameRow As Long

    sameRow = ActiveCell.Row

    Cells(sameRow, 2).Value = startbox.Value
    Cells(sameRow, 3).Value = endbox.Value

    Unload Me

    End Sub

    Private Sub Userform_Initialize()

    eventbox.Clear

    With eventbox
    .AddItem "Event 1"
    .AddItem "Event 2"
    .AddItem "Event 3"
    .AddItem "Not Available"
    End With

    comment.Value = ""

    startbox.Value = ""

    endbox.Value = ""

    End Sub

    **For now I have it set up to just save the start and end dates in columns B and C respectively, but that was just to test to see if the form would work. The events I have place in there are supposed to determine what color the block will be highlighted, but my main concern is being able to actually get a block highlighted from the dates entered.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    something like this perhaps?:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-08-2015
    Location
    Richmond, Virginia
    MS-Off Ver
    Office 13
    Posts
    37

    Re: Highlight a range of cells to match the date

    I see what you have tried to do there and the logic makes sense. But I put that into my code in the savebutton sub while taking everything else out except the unload and nothing showed up on the sheet. Do I need to activate the sheet or should I add that piece of code to what I already had?

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    whoops... supposed to find the date in the header.... my bad.... Headers in row 1 I assume?

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-08-2015
    Location
    Richmond, Virginia
    MS-Off Ver
    Office 13
    Posts
    37

    Re: Highlight a range of cells to match the date

    The headers are row 2. But even when I changed the 1:1 to 2:2 it still didn't show up. Would setting the range from like Column D to Column XR (the dates start at D and go to XR in row 2) work?

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    cmoore... the headers are dates? you are formatting the startbox and endbox date to match the way it is in the headers? (sorry, gonna have to be a bit patient, since I don't have the book, I'm flying a bit blind)... we will get there...

  11. #11
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    Try this?

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    07-08-2015
    Location
    Richmond, Virginia
    MS-Off Ver
    Office 13
    Posts
    37

    Re: Highlight a range of cells to match the date

    Arkadi,

    That worked perfectly. Thank you so much for working through this with me even though I couldn't post the workbook, I really appreciate it.

  13. #13
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlight a range of cells to match the date

    Excellent, and my pleasure. Please take a moment to mark the thread as solved if you are satisfied? Thanks!

+ 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] Find partial match between two columns and highlight cells that match
    By TomToms in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-18-2019, 01:07 PM
  2. Highlight Rows Based on Date Range Using Static Date and Current Date
    By SaraStravers in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-23-2015, 07:38 PM
  3. [SOLVED] highlight a series of cells based on the number of days in a date range
    By b2lynch in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-09-2014, 10:48 PM
  4. Date Range to highlight Cells
    By Arawwawala in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2014, 02:34 PM
  5. highlight if the date match
    By darkhangelsk in forum Excel General
    Replies: 4
    Last Post: 01-07-2010, 10:58 PM
  6. If two cells match (date), highlight a third cell...
    By engeecee in forum Excel General
    Replies: 4
    Last Post: 08-14-2009, 09:47 AM
  7. Match and Highlight Characters in a Range
    By melnikok in forum Excel General
    Replies: 8
    Last Post: 03-20-2008, 02:33 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