+ Reply to Thread
Results 1 to 3 of 3

Macro Code problem when Copying Selected (variable) cells with filters

  1. #1
    Registered User
    Join Date
    09-17-2014
    Location
    Cambridge, England
    MS-Off Ver
    2016
    Posts
    58

    Macro Code problem when Copying Selected (variable) cells with filters

    Hello,

    I have a Macro which works perfectly well except one thing...

    I have one file that each day has the previous days data uploaded over night. Therefore this data file will always vary in rows (columns will always be the same). My Macro does everything I need it to, except the macro doesn't seem to register that each day there may be more rows down than when I created the Macro. The macro is pretty big so I won't paste it all into here. But the coding where the issue lies is as follows...

    Please Login or Register  to view this content.
    Now when recording this macro I specifically used the 'Selection.End(xlDown).Select' as I thought this would always find the end of the cell values within the filtered data for me to then CTRL+SHIFT and UP to capture all of the data. But everytime I run it, the 'Selection.End(xlDown).Select' command doesn't go any further down the data than when I recorded this macro?? it now seems to stop at a specific row and some of the data (within the filtered data) is left behind and not copied onto the other workbook.

    Any thoughts?? It is purely an issue with the active range not always finding the end of the data within the filter.

    Regards
    Last edited by sx200n; 06-16-2015 at 06:53 AM.

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

    Re: Macro Code problem when Copying Selected (variable) cells with filters

    The range to copy is hard coded as A2:X10512 and the range to filter is hard coded as $A$1:$AS$20253.

    The code needs to be changed to take into account the changing no of rows.

    I'll post some code but could you add code tags to the code you posted?

    Code tags
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-17-2014
    Location
    Cambridge, England
    MS-Off Ver
    2016
    Posts
    58

    Re: Macro Code problem when Copying Selected (variable) cells with filters

    Apologies. I have added the Code tags.

    Norie,

    I see what you mean. Clearly something i either added in error when recording the macro. Or an issue where I should have editted the macro after recording it and removing.

+ 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. VBA code to loop through a range of selected cells, to add to my macro
    By craig schultz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2014, 10:30 AM
  2. Problem searching, copying and pasting selected cells between sheets
    By Torben_Fred in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2013, 05:55 PM
  3. copying selected cells formula in macro
    By clundeen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2011, 06:09 AM
  4. Replies: 1
    Last Post: 05-12-2008, 05:53 PM
  5. Macro That Filters by Currently Selected Cell
    By JamieM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2007, 06:50 PM

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