tommychowdah
New Member
- Joined
- Dec 26, 2017
- Messages
- 31
Hello everyone,
Question regarding a macro I have, see pasted below.
I have an excel file with approximately 100 sheets, and would like to automatically format rows and columns for specific sheets based on cell values in row 1 and column a. I have a tab named "List" which is named as "Tab_NAMES" and list all the tabs I wish to run this macro on. The macro takes forever and I am not even sure if I have it written correctly. Any suggestions?
-----
Sub TEST_Hide_All()
Dim StartTime As Double
Dim MinutesElapsed As String
StartTime = Timer
Dim rngCell As Range
Dim strSheetActive As String: strSheetActive = ActiveSheet.Name
Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("List")
For Each rngCell In .Range("B2:B100" & .Range("B" & .Rows.Count).End(xlUp).Row)
If Trim(rngCell.Value) <> vbNullString Then Call Hide(rngCell.Value)
Next rngCell
End With
Application.Goto ThisWorkbook.Worksheets(strSheetActive).Cells(1)
Application.ScreenUpdating = True
Set rngCell = Nothing
MinutesElapsed = Format((Timer - StartTime) / 86400, "m:ss")
MsgBox "The File is Beautiful! (" & MinutesElapsed & " minutes)", vbInformation
End Sub
-----
Question regarding a macro I have, see pasted below.
I have an excel file with approximately 100 sheets, and would like to automatically format rows and columns for specific sheets based on cell values in row 1 and column a. I have a tab named "List" which is named as "Tab_NAMES" and list all the tabs I wish to run this macro on. The macro takes forever and I am not even sure if I have it written correctly. Any suggestions?
-----
Sub TEST_Hide_All()
Dim StartTime As Double
Dim MinutesElapsed As String
StartTime = Timer
Dim rngCell As Range
Dim strSheetActive As String: strSheetActive = ActiveSheet.Name
Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("List")
For Each rngCell In .Range("B2:B100" & .Range("B" & .Rows.Count).End(xlUp).Row)
If Trim(rngCell.Value) <> vbNullString Then Call Hide(rngCell.Value)
Next rngCell
End With
Application.Goto ThisWorkbook.Worksheets(strSheetActive).Cells(1)
Application.ScreenUpdating = True
Set rngCell = Nothing
MinutesElapsed = Format((Timer - StartTime) / 86400, "m:ss")
MsgBox "The File is Beautiful! (" & MinutesElapsed & " minutes)", vbInformation
End Sub
-----
Last edited: