+ Reply to Thread
Results 1 to 14 of 14

Macro and filter, copying data

  1. #1
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Macro and filter, copying data

    Hi,

    There's a bug at the end of the code if there is no data at all to copy. I would like that the macro keep working on even tough sometime there is no data availaible. Any clue? I put the command in bold.

    Please Login or Register  to view this content.
    Last edited by extremis; 05-03-2013 at 02:15 PM.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro and filter, copying data

    You can use "on error resume next" at the start of your code.

    However if you attach your workbook Ill be able to judge better what kind of error tackler you would need!
    Cheers!
    Deep Dave

  3. #3
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    at the start of the code. Which part? Could you tell me where to put it please

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro and filter, copying data

    You can put it after
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    Well...it give me error 1004

    no cell was found.

    I put the code like this, Dim rDataRange As Range ' data range "on error resume text"

    And it didnt work

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro and filter, copying data

    Can you please attach the file?

  7. #7
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    Will do. Give me one hour or so!!!!

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro and filter, copying data

    Hi, extremis,

    maybe check the number of visible rows in the sheet before copying?
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  9. #9
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    Excel cannot complete with available ressource...

    Macro error give me :paste method class failed...

    here is the second macro where it failed. Line is in bold.

    Please Login or Register  to view this content.

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro and filter, copying data

    Hi, extremis,

    if the problem this thread was created for is solved you maybe should tell us and not follow up with a totally different problem in another code.

    To cut a long story short:

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Ciao,
    Holger

  11. #11
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    test1.xlsmHi,

    the problem arise from the same issue. Basicly, those 2 macro are linked together! The second problem arise from the first one...

    I don't know if you follow me...

    here is an exemple of the file

  12. #12
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    thanks also for the help, much appreciated!!!

  13. #13
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro and filter, copying data

    Hi, extremis,

    I don't know if you follow me...
    I´m not so sure about that as well.

    Let me try to explain what I understand right now: if the first macro won´t copy any values the second doesn´t need to be run. If that is correct you could extend the If-Statement for the Else-part like this:
    Please Login or Register  to view this content.
    I´m afraid I can´t find a pivot table in the sheet to test the entire code but I may guess that maybe you could copy/paste the pivot and then try working on it.

    Ciao,
    Holger

  14. #14
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Macro and filter, copying data

    yoU,re the king..love the logic :D

+ 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