|
Sub 隐藏()Dim Rng As Range
Dim a As Date
Dim b As Date
Dim c As Date
Dim d As Date
Dim e As Date
Dim f As Date
Dim g As Date
Dim h As Date
Dim i As Date
Dim j As Date
Dim k As Date
Dim l As Date, m As Integer, n As Integer, o As Integer, p As Integer, q As Integer
a = "2013-1-10 00:00"
b = "2013-2-10 00:00"
c = "2013-3-10 00:00"
d = "2013-4-10 00:00"
e = "2013-5-10 00:00"
f = "2013-6-10 00:00"
g = "2013-7-10 00:00"
h = "2013-8-10 00:00"
i = "2013-9-10 00:00"
j = "2013-10-10 00:00"
k = "2013-11-10 00:00"
l = "2013-12-10 00:00"
m = Year(dd)
n = Month(dd)
o = Day(dd)
p = Hour(dd)
q = Minute(dd)For Each Rng In Range("a:a")
If Rng = a or Rng =b or Rng =c or Rng =d or Rng =e or Rng =f or Rng =g or Rng =h or Rng =i or Rng =j or Rng =k or Rng =l Then
Rows(Rng.Row).EntireRow.Hidden = True
End If
Next End Sub
这段代码是隐藏工作表里特定行的代码,我想让每个工作表都运行这个宏,请问在哪里加什么代码能实现呀。
- Sub 隐藏()
- Dim Rng As Range
- Dim a As Date
- Dim b As Date
- Dim c As Date
- Dim d As Date
- Dim e As Date
- Dim f As Date
- Dim g As Date
- Dim h As Date
- Dim i As Date
- Dim j As Date
- Dim k As Date
- Dim l As Date, m As Integer, n As Integer, o As Integer, p As Integer, q As Integer
- Dim sht As Worksheet
- a = "2013-1-10 00:00"
- b = "2013-2-10 00:00"
- c = "2013-3-10 00:00"
- d = "2013-4-10 00:00"
- e = "2013-5-10 00:00"
- f = "2013-6-10 00:00"
- g = "2013-7-10 00:00"
- h = "2013-8-10 00:00"
- i = "2013-9-10 00:00"
- j = "2013-10-10 00:00"
- k = "2013-11-10 00:00"
- l = "2013-12-10 00:00"
- m = Year(dd)
- n = Month(dd)
- o = Day(dd)
- p = Hour(dd)
- q = Minute(dd)
- For Each sht In Worksheets
- With sht
- For Each Rng In .Range("a:a")
- If Rng = a Or Rng = b Or Rng = c Or Rng = d Or Rng = e Or Rng = f Or Rng = g Or Rng = h Or Rng = i Or Rng = j Or Rng = k Or Rng = l Then
- .Rows(Rng.Row).EntireRow.Hidden = True
- End If
- Next
- End With
- Next
- End Sub
复制代码
|
|