Macro stops working after rows/columns hidden call

stefsj

New Member
Joined
May 27, 2010
Messages
23
Hi,

I have been having issues with an old file of mine.

I have few different subs that have the rows().Hidden included in them. No matter what call I make, after the macro hides/unhides the rows it stops working and doesn't go to the next line of code. It could be as simple as this:
Code:
Sub ViewTestArea()
    Call SheetProtect
    If Rows("4:22").Hidden = True Then
        ActiveWindow.FreezePanes = False
        Rows("4:22").Hidden = False   'will stop after this 
    Else:
        Rows(32).Select
        ActiveWindow.FreezePanes = True
        Rows("4:22").Hidden = True   'or after this
        Cells(31, 1).Select
    End If
End Sub

I have few other calls that do the same thing so it is not just this one subroutine.

I believe there must be some bugs in the file to do this. I am reworking this file now from scratch and sometimes notice the same thing, but if I save it and reopen it again it will work normally.

Any ideas why is this happening?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,566
Messages
6,120,266
Members
448,953
Latest member
Dutchie_1

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