|
Private Sub CommandButton3_Click()
On Error Resume Next
With Sheets("教室安排情况")
If .Cells.Find(Format(ComboBox7.Text, "m月d")) Is Nothing Then
MsgBox "工作表内没有找到该起始月份的教窒,终止执行!!", 16, "提示"
Exit Sub
End If
End With
With Sheets("教室安排情况")
If .Cells.Find(Format(ComboBox8.Text, "m月d")) Is Nothing Then
MsgBox "工作表内没有找到该结束月份的教窒,终止执行!!", 16, "提示"
Exit Sub
End If
End With
If ComboBox2.ListIndex = -1 Or ComboBox2.Text = "" Then
ComboBox2.SetFocus
MsgBox "请选择教窒厅后再查询!!", 64, "提示"
Exit Sub
End If
Application.ScreenUpdating = False
With Sheets("教室安排情况")
Cells.EntireRow.Hidden = False
Cells.EntireEntireColumn.Hidden = False
Dim x As Long
For x = .Range("B" & Rows.Count).End(xlUp).Row To 4 Step -1
.Cells(x, 2).EntireRow.Hidden = IIf(.Cells(x, 2).Text = Replace(ComboBox2.Text, .Cells(x, 1).Text & "-", ""), False, True)
Next
Dim y As Long
For y = .Cells(2, Columns.Count).End(xlToLeft).Column To 4 Step -1
y3 = Format((ComboBox3.Text & "年" & .Cells(2, y).Value & "日"), "yyyy-m-dd")
y4 = Format((ComboBox5.Text & "年" & .Cells(2, y).Value & "日"), "yyyy-m-dd")
If y3 >= Format(ComboBox7.Text, "yyyy-m-dd") And y4 <= Format(ComboBox8.Text, "yyyy-m-dd") Then
.Columns(y).EntireColumn.Hidden = False
Else
.Columns(y).EntireColumn.Hidden = True
End If
Next
End With
Application.ScreenUpdating = True
End Sub
[ 本帖最后由 daley 于 2010-6-30 00:57 编辑 ] |
|