Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to hide rows
I have the following code that runs when a button in clicked, which works
very well. However, if the sheet is unprotected when the button is clicked, an error msg. appears the next time the button is clicked indicating that the password you selected is incorrect. I know that what is happening is that that the sheet is being protected again in this code. I've asked the admin for this file to quit clicking the button when the sheet is unprotected, but I can't count on that. Is there a way to hide a button if a sheet is unprotected? If not, is there a better way to write this code that will hide rows Cells(rw, 1).Range("D1:W1")) = 0? Thank you very much. Sub Hide_Rows_BldgG() Dim rw As Long Application.ScreenUpdating = False ActiveSheet.Unprotect Password:="grencr" With ActiveSheet For rw = 14 To 73 If Application.WorksheetFunction.CountA( _ .Cells(rw, 1).Range("D1:W1")) = 0 Then _ .Rows(rw).Hidden = True Next rw End With ActiveSheet.Protect Password:="grencr" Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro code to hide rows and not calculate hidden rows | Excel Discussion (Misc queries) | |||
Macro to hide rows | Excel Discussion (Misc queries) | |||
hide rows with macro | Excel Discussion (Misc queries) | |||
macro to hide rows | Excel Discussion (Misc queries) | |||
Macro to hide rows | Excel Programming |