Hi, I have put together this code to hide all blank cells in certain Row ranges across an array of worksheets.
It works ok, but it seems to take some time to complete and uses alot of computer resources to run.
Is it possible to use alternative VBA code to be more efficient and speed up the execution time and reduce the CPU/RAM usage?
I have a similar code to reverse the operation and unhide the rows in which I just changes the "True" to "False".
Also, is there syntax that can be added that autofits the rows/cells to the content when unhiding the rows?
Thanks
It works ok, but it seems to take some time to complete and uses alot of computer resources to run.
Is it possible to use alternative VBA code to be more efficient and speed up the execution time and reduce the CPU/RAM usage?
VBA Code:
Sub HideBlankRowsAllTabs()
sheetlist = Array("MS002", "MS003", "MS004", "MS005", "MS006", "MS007", "MS008", "MS009", "MS010", "MS011", "MS012")
For i = LBound(sheetlist) To UBound(sheetlist)
Worksheets(sheetlist(i)).Activate
For Each cell In Range("A330:A386")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
For Each cell In Range("B293:B296")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
For Each cell In Range("B232:B288")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
For Each cell In Range("B197:B207")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
For Each cell In Range("B176:B188")
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
Next
End Sub
I have a similar code to reverse the operation and unhide the rows in which I just changes the "True" to "False".
Also, is there syntax that can be added that autofits the rows/cells to the content when unhiding the rows?
Thanks