Set xF = Rows(2).Find(xLRng, xLRng.Offset(, -1), LOOKAT:=xlPart, LookIn:=xlValues) '尋找
Do
Set Rng = Union(Rng, xF)
Set xF = Rows(2).FindNext(xF)
Loop While xLRng.Address <> xF.Address '一直到是第一尋找到的位置
Cells.EntireColumn.Hidden = True
Rng.EntireColumn.Hidden = False
Rng.Select
With ActiveWindow
.SplitColumn = 6
.SplitRow = 2
.FreezePanes = True
End With
End Sub
複製代碼
作者: myleoyes 時間: 2012-8-31 12:22
回復 6#GBKEE
良師!謝謝!!程式修改如下
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
If Target(1).Row = 2 Then
Select Case Target(1).Column
Case 1
[A:E].Cells.EntireColumn.Hidden = False '增加此列
With ActiveWindow
.SplitColumn = 1 '修改處
.SplitRow = 2 '修改處
.FreezePanes = True
End With
[A:IV].Cells.EntireColumn.Hidden = True '修改處
[A:IV].Cells.EntireColumn.Hidden = False '修改處
[A1].Select
Case 2 To 5
隱藏 Target(1)
End Select
End If
Application.EnableEvents = True
End Sub
另有一程式(點選下拉)如附檔案!請再幫忙一下辛苦囉!!謝謝再三!作者: GBKEE 時間: 2012-8-31 17:32