I have code for Hiding and Unhiding rows in Excel sheet.
Current problem is:
1) Running twice NewUnhideJobs (position of second section)
2) Running once HideAllJobs
3) Running NewUnhideJobs
As the result we have position of third section and not first as it should be. So NewUnhideJobs does not start from 0 but continues to do previous procedure.
Removing of Static counter As Byte was tried but code does not work without it.
counter = 0 was also tried in HideAllJobs without success.
Hiding rows:
Unhiding rows:
P.S. Posted also here https://stackoverflow.com/questions/54881262
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"></code>
Current problem is:
1) Running twice NewUnhideJobs (position of second section)
2) Running once HideAllJobs
3) Running NewUnhideJobs
As the result we have position of third section and not first as it should be. So NewUnhideJobs does not start from 0 but continues to do previous procedure.
Removing of Static counter As Byte was tried but code does not work without it.
counter = 0 was also tried in HideAllJobs without success.
Hiding rows:
Code:
Sub NewUnhideJobs()
Static counter AsByte
Dim RngTxt AsString, RngAR()AsString, ThisRng AsString
counter =(counter +1)Mod26
ThisRng =""&(174-(counter *5))&":"&(174-(counter *5)+4)
Application.ScreenUpdating =False
ThisWorkbook.Sheets("Filling form").Unprotect
ThisWorkbook.Sheets("Filling form").Rows(ThisRng).EntireRow.Hidden =False
ThisWorkbook.Sheets("Filling form").Protect
Application.ScreenUpdating =True
EndSub
Unhiding rows:
Code:
Sub HideAllJobs()
Static counter AsByte
Application.ScreenUpdating =False
ThisWorkbook.Sheets("Filling form").Unprotect
Rows("49:173").EntireRow.Hidden =True
counter =0
ThisWorkbook.Sheets("Filling form").Protect
Application.ScreenUpdating =True
EndSub
P.S. Posted also here https://stackoverflow.com/questions/54881262
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"></code>
Last edited: