Re: Identifying a variety of holidays in a data set
I found a solution that will work for me - I did not use the code from my original post. Below is an excerpt of the coding from my Macro (granted, all the variables are not defined in this excerpt). I embedded an IsDate function in an IF statement, to verify that the cell value was a date - if the value is not a date, then the "LSearchRowMod = LSearchRowMod + 1" portion moves the search to the next line. If a date is found and it matches the "month" and "day" criteria, then it is copied into Sheet2. I can then replicate this code for each date that I want to search.
Thank you again for your help.
Code
srchDate = CDate("12/24/2000")
For Each rngCell In Range(SrchClmn & LSearchRowMod & ":" & SrchClmn & lngLstRow)
If IsDate(Range(SrchClmn & CStr(LSearchRowMod))) Then
If Month(Range(SrchClmn & CStr(LSearchRowMod)).Value) = Month(srchDate) And Day(Range(SrchClmn & CStr(LSearchRowMod)).Value) = Day(srchDate) Then
'Select row in Sheet1 to copy
Rows(CStr(LSearchRowMod) & ":" & CStr(LSearchRowMod)).Select
Selection.Copy
'Paste row into Sheet2 in next row
Sheets("Sheet2").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.Paste
'Move counter to next row
LCopyToRow = LCopyToRow + 1
'Go back to Sheet1 to continue searching
Sheets(shtName).Select
End If
LSearchRowMod = LSearchRowMod + 1
Else
LSearchRowMod = LSearchRowMod + 1
End If
Next
Display More