Board logo

標題: 隐藏列 [打印本頁]

作者: wqfzqgk    時間: 2010-7-6 09:35     標題: 隐藏列

Private Sub CommandButton1_Click()
If CommandButton1.Caption = "恢复" Then
        Cells.Columns.Hidden = False
        CommandButton1.Caption = "隐藏"
    Else
        CommandButton1.Caption = "恢复"
        col = ActiveSheet.UsedRange.Columns.Count
        rowss = ActiveSheet.UsedRange.Rows.Count
        For i = 2 To col
            If Application.WorksheetFunction.CountA(Range(Cells(4, i), Cells(rowss, i))) = 0 Then Columns(i).Hidden = True
        Next i
    End If
End Sub




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)