+ Reply to Thread
Results 1 to 5 of 5

Ungroup causes Run-time 1004 error

  1. #1
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115

    Ungroup causes Run-time 1004 error

    Hello

    I'm using the following code to "reset" a worksheet, that is, clear all contents, column/row grouping etc. For some worksheets there may not be any grouping, and when I run the macro I receive a Run-time error '1004' Ungroup method of Range class failed.

    Can someone suggest an appropriate "On Error Resume" code for the following code, such that if the worksheet contains data the data is cleared and columns/rows reset?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    try
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    Thanks BigBas!

    I thought an "On Error Resume Next" needed a "Next xxx" to work.

    Am I correct in thinking that the "Next" actually refers to the next line or operation, and doesn't need a specific "Next xxx" after the block of code?

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    It is my understanding (and I could be incorrect) that it went on with the code. I think the bit of code that needs an identifier is the GoTo Error Handler, ie:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    Thanks for explaining that BigBas. I do appreciate it and now I've learnt something!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code Execution Degrades Over Time
    By KDT in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-25-2008, 04:28 PM
  2. Error # 1004 was generated by Microsoft office Excel
    By johnson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2008, 12:56 PM
  3. worksheetfunction.run time error '1004'
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-04-2008, 06:56 PM
  4. Run-time error 1004 - application-defined or object-defined error
    By lottesfog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-25-2007, 02:46 AM
  5. Problem Run-time error '1004'
    By PeterSi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2007, 08:46 AM

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