|
首先要谢谢你,但是我又要麻烦你了。
就是当我选择后面的日期比前面大的时候就出错了,是不是再作个判断,如果前面的小于后面的日期就该跳出提示框“开始的日期必须小于结束日期"
我不知道该怎么加程序, ,
Dim CEL
Dim RNG, RNG2
Dim R, R2
CEL = Sheet1.Range("IV5").End(xlToLeft).Address(0, 0)
With Sheet1.Range("H5:" & CEL)
Set RNG = .Find(CDate(Me.CmbStart), LookIn:=xlFormulas).Offset(0, -1)
Set RNG2 = .Find(CDate(Me.Cmbend), LookIn:=xlFormulas).Offset(0, 1)
End With
If Not RNG Is Nothing And Not RNG2 Is Nothing Then
R = RNG.Address(0, 0)
R2 = RNG2.Address(0, 0)
Columns("H:" & Left(R, Len(R) - 1)).Hidden = True
Columns(Left(R2, Len(R2) - 1) & ":BJ").Hidden = True
End If
End Sub |
|