Wednesday, September 28, 2011

Unhide ALL Rows & Cols From A worksheet

Sub unhide_all_rows_cols_from_all_worksheets()
'it will unhide all rows and cols from all worksheets in a workbook
Dim wk As Worksheet
For Each wk In ThisWorkbook.Sheets
wk.Select
Cells.EntireRow.Hidden = False
Cells.EntireColumn.Hidden = False
Next wk

End Sub


Sub unhide_all_rows_cols__for_specific_worksheets()
'it will unhide all rows and cols from all worksheets in the list Array("Sheet1", "Sheet2")
Dim abc()
Dim wk As Worksheet
Dim i As Integer
abc = Array("Sheet1", "Sheet2")
For i = LBound(abc) To UBound(abc)
For Each wk In ThisWorkbook.Sheets
If wk.Name = abc(i) Then
wk.Select
Cells.EntireRow.Hidden = False
Cells.EntireColumn.Hidden = False
Exit For
End If
Next wk
Next i
End Sub

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...