+ Reply to Thread
Results 1 to 11 of 11

Excel is not reading

  1. #1
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Excel is not reading

    Hello everyone,

    I don't know why, but Excel is not reading my code.

    It doesn't work when I play it normal, but it works When I read the code line to line.

    Can someone help me?

    The essencial part of the code is with the green colour.

    Please Login or Register  to view this content.
    Thanks a lot

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Excel is not reading

    Try changing it to :
    Please Login or Register  to view this content.
    Please click the * below if this helps

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel is not reading

    Which worksheet is this supposed to clear cells on?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Excel is not reading

    thanks a lot

  5. #5
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Excel is not reading

    Norie, it depends.

    But imagine that is sheet 2. What should I do?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel is not reading

    It might be sheet2, but only if that sheet is active.

    If it's supposed to be clearing a range on a specific worksheet you should add a reference to that sheet as you've done throughout the rest of the code.

  7. #7
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Excel is not reading

    But if I do Folha7.Range("AI3", Range("AI3").End(xlDown)).Clear it gives me an error.

    The code JasperD wrote works fine.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel is not reading

    The code in the original post will clear data on whatever sheet is active, as will Jaspers.

    So if the right sheet is active then it will work.

    To clear the right sheet even if it's not active you need to reference the sheet.

    The code you just posted almost does that, but the 2nd Range doesn't have a worksheet reference so refers to teh active sheet.

    This makes sure both Ranges have a worksheet reference.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Excel is not reading

    OK, let me see, but .clear is missing on that right?

    Thanks!

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel is not reading

    That's just a typo, easily fixed.
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Excel is not reading

    It's working, thanks a lot !

+ 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