|
Sub 隐藏()
Dim i, rng As Range
Range("D:AH").EntireColumn.Hidden = True
arr = Range("a12:ah12")
rq1 = Cells(8, 3)
For i = 4 To UBound(arr, 2)
If arr(1, i) <> "" Then
rq = --Split(arr(1, i), "日")(0)
If rq = rq1 Then
If rng Is Nothing Then Set rng = Cells(1, i) Else Set rng = Union(rng, Cells(1, i))
For j = 1 To 5
If arr(1, i + j) = "" Then
Else
n = n + 1
Set rng = Union(rng, Cells(1, i + j))
If n = 2 Then Exit For
End If
Next
n = 0
For j = 1 To 5
If arr(1, i - j) = "" Then
Else
n = n + 1
Set rng = Union(rng, Cells(1, i - j))
If n = 2 Then Exit For
End If
Next
Exit For
End If
End If
Next
If Not rng Is Nothing Then rng.EntireColumn.Hidden = False
End Sub |
评分
-
1
查看全部评分
-
|