Results 1 to 7 of 7

Need to check if cell value is equal to a named range (of dates)

Threaded View

chiidzzz Need to check if cell value... 09-18-2017, 03:33 PM
xladept Re: Need to check if cell... 09-18-2017, 04:50 PM
chiidzzz Re: Need to check if cell... 09-18-2017, 05:11 PM
xladept Re: Need to check if cell... 09-18-2017, 05:56 PM
xladept Re: Need to check if cell... 09-18-2017, 05:51 PM
chiidzzz Re: Need to check if cell... 09-19-2017, 12:30 AM
xladept Re: Need to check if cell... 09-19-2017, 11:50 AM
  1. #1
    Forum Contributor
    Join Date
    07-08-2012
    Location
    beirut
    MS-Off Ver
    Excel 2010
    Posts
    102

    Need to check if cell value is equal to a named range (of dates)

    Hi, I want to check if the value of certain cells is equal to one of the dates in sheet 2, named "holiday", and then input certain characters in them.
    I provided a sample, in which case the code only checks if the cells in sheet 1 are equal to sheet 2, cells A2 and A3; how can I write a better code where it would check all my named range ( "Holiday" in sheet 2)? Thanks
    Sub test()
    Dim i As Integer
    Dim j As Variant
    Sheet1.Select
    For i = 0 To 2
    j = 2 + (6 * i)
    Cells(5, j) = "x"
    Cells(5, j + 1) = "A"
    If Cells(4, j + 2).Value = Sheet2.Cells(2, 1) Or Cells(4, j + 2).Value = Sheet2.Cells(3, 1) Or Weekday(Cells(4, j + 2), vbMonday) > 5 Then
    Cells(5, j + 2) = "-"
    Else
    Cells(5, j + 2) = "o"
    End If
    Cells(5, j + 3) = "o"
    Cells(5, j + 4) = "o"
    Cells(5, j + 5) = "o"
    Next i
    End Sub
    Attached Files Attached Files
    Last edited by chiidzzz; 09-18-2017 at 03:36 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Check if cell is a named range
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2015, 12:15 PM
  2. check for match of cell to range of cells only if another cell is equal to X
    By rfigueroa1976 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-25-2015, 07:51 PM
  3. Count if cell range dates are equal to monday
    By suban.p in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-13-2014, 10:12 AM
  4. If Dates in range equal today then copy cell x
    By Greg420 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 15
    Last Post: 03-20-2014, 09:47 AM
  5. Replies: 1
    Last Post: 02-27-2013, 12:00 AM
  6. Check if cell is part of a named range
    By RobynC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2008, 02:31 PM
  7. Replies: 1
    Last Post: 05-25-2006, 04:55 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