marshybid
04-28-2008, 01:26 AM
Morning All,
I am currebtly filtering out certain rows of data based on one criteria which is fixed (see code below).
I would like to beable to add another criteria which is variable and therfore needs to be manually entered, probably via a form. This data will be two dates - start date and end date. I have no experience of using forms, so could anyone please help.
Current Code =
'// Delete non required data from each worksheet
Sheets("Approved Timesheets").Select
Set myBaseWorkSheet = ActiveWorkbook.ActiveSheet
Set myBaseRange = myBaseWorkSheet.Rows
For RowsCounter = myBaseRange.Rows.Count To 2 Step -1
Set myBaseRow = myBaseRange.Item(RowsCounter)
If Len(myBaseRow.Cells.Item(1, 1)) <> 0 Then
'// Delete data that we do not need for each tab
If myBaseRow.Cells.Item(1, 21) <> "Approved" Then
myBaseRow.Delete
End If
End If
Next
I know that I need to add in another If statement - If myBaseRow.Cells.Item(1, 46) >=Start Date and <=End date Then
Thanks in advance
Marshybid
I am currebtly filtering out certain rows of data based on one criteria which is fixed (see code below).
I would like to beable to add another criteria which is variable and therfore needs to be manually entered, probably via a form. This data will be two dates - start date and end date. I have no experience of using forms, so could anyone please help.
Current Code =
'// Delete non required data from each worksheet
Sheets("Approved Timesheets").Select
Set myBaseWorkSheet = ActiveWorkbook.ActiveSheet
Set myBaseRange = myBaseWorkSheet.Rows
For RowsCounter = myBaseRange.Rows.Count To 2 Step -1
Set myBaseRow = myBaseRange.Item(RowsCounter)
If Len(myBaseRow.Cells.Item(1, 1)) <> 0 Then
'// Delete data that we do not need for each tab
If myBaseRow.Cells.Item(1, 21) <> "Approved" Then
myBaseRow.Delete
End If
End If
Next
I know that I need to add in another If statement - If myBaseRow.Cells.Item(1, 46) >=Start Date and <=End date Then
Thanks in advance
Marshybid