While searching the internet, I came across the following code, which searches a data set for the macro-defined search terms, and copies them into a separate workbook. This code works splendidly, however, I would like to modify it to search for certain holidays. However, I have never worked with these types of date-defining/constricting codes before. In a simple example, how might I modify this code to search for January 1, December 24, and December 25... instead of Fruit 2, Fruit 5, and Fruit 18?
Thank you in advance for your help!
Code
Sub FruitBasket()
Dim rngCell As Range
Dim lngLstRow As Long
Dim strFruit() As String
Dim intFruitMax As Integer
intFruitMax = 3
ReDim strFruit(1 To intFruitMax)
strFruit(1) = "Fruit 2"
strFruit(2) = "Fruit 5"
strFruit(3) = "Fruit 18"
lngLstRow = ActiveSheet.UsedRange.Rows.Count
For Each rngCell In Range("A2:A" & lngLstRow)
For i = 1 To intFruitMax
If strFruit(i) = rngCell.Value Then
rngCell.EntireRow.Copy
Sheets("Inventory").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial xlPasteValues
Sheets("Fruit").Select
End If
Next i
Next
End Sub
Display More