+ Reply to Thread
Results 1 to 13 of 13

Range.clear failure

  1. #1
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Range.clear failure

    Hi, i'm creating an excel front end for an access db and currently the getting data bit is working nicely..

    so i was happily coding away until this happened!:


    Please Login or Register  to view this content.
    and the range.clear failed... this is irratating as if i remove it it will leave aspects on the page and be confusing for both the program and the user :-(

    and chance you can point me in the right direction?

    thanks!

    Jonathan
    Last edited by Jollyfrog; 10-06-2010 at 12:15 PM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,977

    Re: Range.clear failure

    Failed how? Error, explosion, sudden rain of jelly? If by chance it was an error, what was the error message?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    i get a "class method of range class failed!"

    i assumed i'd only get that if i called a sheet which wasn't the active one .. apparently this isn't the case!

    thanks

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Range.clear failure

    I suppose your intention is to clear the contents of a given cell:

    Please Login or Register  to view this content.
    I can't think of any error message in this case unless the sheet doesn't exist, the cell is protected or part of an array.



  5. #5
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    Thanks tried that, its not protected, and i removed any associated security and formatting, validation, associated with the cell and ran the code again!, but same error

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Range.clear failure

    What happens if you try to empty this cell manually ?

    (is a querytable connected to this cell ?)

  7. #7
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    Removing content manually works fine! and it is not connected to a query table

  8. #8
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    i alos tried

    Please Login or Register  to view this content.
    but this produces the same error!

  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Range.clear failure

    Are you sure the name Sheets("Edit Package") is written correctly ?
    Are several workbook open ? In that case you should mention the workbook too:

    Please Login or Register  to view this content.
    another approach:

    Record a macro emptying this cell; compare the recorded macro with you current code.

  10. #10
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    the code gives me the error, subset out of range!


    i tried a macro which gave me the code:

    Please Login or Register  to view this content.
    but this errors too when i use it!

  11. #11
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    hmm when i use the code
    Please Login or Register  to view this content.
    as a seperate function it seems to work ok...

    must be an issue somewhere else in my code

    Please Login or Register  to view this content.

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Range.clear failure

    the code gives me the error, subset out of range!
    I bet you got that because you didn't adapt my code (or it would be a rare coincidence that one of the opend workbooks is called 'opened.xls'

    I think it's time to put your workbook here and tell us how many workbooks are opened at the same time the macro is running and where you store the macro you are running.

  13. #13
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Range.clear failure

    what the..... now it works..

    i opened a different workbook to do something else and then came back to it and it worked..... i've been on this since yesterday

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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