|
楼主 |
发表于 2018-5-31 10:42
|
显示全部楼层
含有字段的 rev_raised,进行隐藏- Sub hide()
- Dim rows, cols As Integer
- 'batch all sheets in this workbook
- For Each sh In ThisWorkbook.Sheets
- If sh.Name <> "content" And sh.Name <> "summary" Then 'read all sheets except the two sheets
- With sh
- .Unprotect
- rows = .[A65536].End(xlUp).Row 'get row number
- cols = .[IV1].End(xlToLeft).Column 'get column number
- 'hide
- Key = Array("rev_raisedDate_", "rev_raisedDay_")
- For j = 1 To cols
- Set rngexp = CreateObject("VBScript.RegExp")
- With rngexp
- .Global = True
- .Pattern = "^[\w\d_-\+\.]+$"
- End With
- '.Cells(4, j) = rngexp.Replace(.Cells(4, j).Value, "")
- '.Cells(4, j).Value = Application.Clean(.Cells(4, j).Value)
- For k = 0 To 1
- Set Rng = .Cells(4, j).Find(what:=Key(k), lookat:=xlWhole)
- If Not Rng Is Nothing Then .Columns(j).Hidden = True
- Next k
- 'If Trim(.Cells(1, j).Value) = "a1" Then .Columns(j).Hidden = True
- 'If InStr(Trim(.Cells(1, j)), "_date") > 0 Then .Columns(j).Hidden = True
- 'If Right(Trim(.Cells(1, j)), 4) = "date3" Then .Columns(j).Hidden = True
- 'If Find("_vsdate_dddd", .Cells(1, j), 1) > 0 Then .Columns(j).Hidden = True
- Next j
- 'show all columns
- 'For j = 1 To cols
- ' .Columns(j).Hidden = False
- ' Next j
- End With
- End If
- Next sh
- End Sub
复制代码
"Date"& vbcrlf &"[rev_raisedDate_]"
"Days" & vbcrlf & "[rev_raisedDay_]" |
-
|