Macro Issue

matta13

New Member
Joined
Jul 5, 2016
Messages
1
Hello all,

I have been recently tasked with taking over a report someone else created and distributed to several individuals throughout the company. The person who created this made some macros that when a certain range of cells are double clicked one would hide all unused rows and the other would unhide all rows. Well now when someone goes and clicks the unhide rows button it keeps all the rows hidden still. And if I manually unhide because the hidding of rows is done based off a filter and then click unhide all rows it hides all the ones that the hide button does. HEre is are the codes for both. There is a formula in column A to determine if the row show be hidden or not displaying either blank or "hide". Any help would be greatly appreciated. Here is are the codes for both.

Sub SNAPSHOT_ROWS_HIDE()
'
' SNAPSHOT_ROWS_HIDE Macro
'


'
ActiveWorkbook.Save

ActiveSheet.Unprotect Password:="ave5warV2"

Application.ScreenUpdating = False

ActiveSheet.Range("$A:$A").AutoFilter Field:=1, Criteria1:="<>*HIDE*" _
, Operator:=xlAnd

ActiveSheet.Protect Password:="ave5warV2", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowFiltering:= _
True

End Sub

Sub SNAPSHOT_ROWS_UNHIDE()
'
' SNAPSHOT_ROWS_UNHIDE Macro
'


'
ActiveWorkbook.Save

Application.ScreenUpdating = False

ActiveSheet.Unprotect Password:="ave5warV2"

ActiveSheet.Range("$A:$A").AutoFilter Field:=1, Criteria1:=Array("0", _
"HIDE", "="), Operator:=xlFilterValues

ActiveSheet.Protect Password:="ave5warV2", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowFiltering:= _
True

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Code:
Sub myHide()
     Unprotect Password:="ave5warV2"
     Application.ScreenUpdating = False
     Cells.Hidden = False
     r = 1
     lastRow = Range("A" & Rows.Count).End(xlUp).Row
     Do Until r > lastRow
          valueA = Range("A" & r).Value
          If LCase(valueA) Like "*hide*" Then
               Rows(r).Hidden = True
          End If
          r = r + 1
     Loop
     Application.ScreenUpdating = True
     Protect Password:="ave5warV2"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top