+ Reply to Thread
Results 1 to 6 of 6

Macro stops working after rows/columns hidden call

  1. #1
    Registered User
    Join Date
    05-27-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro stops working after rows/columns hidden call

    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:

    Please Login or Register  to view this content.
    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?

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Macro stops working after rows/columns hidden call

    I wonder if you are trying to do something with the hidden row. If you hide a row and try to select a cell in that row, do you get the same error message?

    Set a breakpoint in your code and step through it, while looking at the worksheet to see what is happening.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    05-27-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro stops working after rows/columns hidden call

    Quote Originally Posted by MarvinP View Post
    I wonder if you are trying to do something with the hidden row. If you hide a row and try to select a cell in that row, do you get the same error message?

    Set a breakpoint in your code and step through it, while looking at the worksheet to see what is happening.
    No unfortunately. I am not selecting anything from that row. And I know that it stops at there because I do the step-by-step process and it simply stops the macro after it hides the row. Doesn't even go to "End Sub"

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Macro stops working after rows/columns hidden call

    I think the problem is in your SheetProtect routine.

    What have you allowed the user to do. I'd bet you have protected the sheet to the point they can't select a cell you want them to select so you get an error message.

    Read http://spreadsheets.about.com/od/exc...28_protect.htm which has all the options you can protect.

  5. #5
    Registered User
    Join Date
    05-27-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro stops working after rows/columns hidden call

    Well,

    If that's true it should work when the sheet is unprotected, but it doesn't. This is a simple code that works on any other file, but in this particular file it crashes at that row and it is a mystery for me.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Macro stops working after rows/columns hidden call

    My father in law used to use this line on me frequently. Things would crash and he would say "I didn't change anything" or "It worked on all other sheets that are exactly the same".

    If it crashes on this and not on others, you job is to find what is different between THIS one and all the others.

    It all comes down to some assumpion you have that is false. You assume the only difference is unprotected or protected. Perhaps it is something else!? It will continue to be a mystery until you find which assumption you have that is not exactly correct.

    I couldn't run you code as you had a call to SheetProtect that you didn't supply. Your code ran find on my machine when I commented out the call.
    Last edited by MarvinP; 03-17-2011 at 07:54 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1