I am using a user form to enter a start date & end date. The dates are found using the find method and set the rows where bith dates are on the worksheet.
I need advice on how to loop to set the 2 variables for the dates rows at present I have the same code twice but using the dates see below:
Thanks in advance
I need advice on how to loop to set the 2 variables for the dates rows at present I have the same code twice but using the dates see below:
Code:
'Start Date
strStartDate = Format(txtStartDT, "Short Date")
'Find Start Date Row
Set rng = rngCol.Find(What:=CDate(strStartDate), _
After:=Cells(1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
'Set Start Date Row
lngStartRow = rng.Row
'End Date
strEndDate = Format(txtEndDT, "Short Date")
'Find Stop Date
Set rng = rngCol.Find(What:=CDate(strEndDate), _
After:=Cells(1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
'Set Stop Date Row For Copying
lngStopRow = rng.Row