我有大量信息,并且以开始和结束日期列的形式输入了一些信息。我想要说的是,如果您在所选日期范围之外然后删除单元格的内容,右侧 3 和左侧 -4。所以 -4 在开始日期的左边和 3 在结束日期的右边。
我开始了,但如果您不在我的单元格日期范围内,我在删除时遇到问题
Private Sub cmdFilter_Click()
' Function to filter dates between text boxes, deletes all not in the range
Dim stStart As String, stEnd As String
Dim dbStart As Double, dbEnd As Double
Application.ScreenUpdating = 0
'Turn off screen updating until process done so it doesnt flicker
stStart = txtStart.Value
stEnd = txtEnd.Value
If Not IsDate(stStart) Or Not IsDate(stEnd) Then
MsgBox "Invalid Dates", vbExclamation, "Input Error"
GoTo ExitSub
End If
dbStart = CDbl(CDate(stStart))
dbEnd = CDbl(CDate(stEnd))
' change to highlight cell for time being
INSERT DELETE IF OUT OF RANGE HERE?
ExitSub:
Application.ScreenUpdating = 1
End Sub
提前致谢