+ Reply to Thread
Results 1 to 10 of 10

Convert Copy/Paste VBA to Macro without Copy/Paste

  1. #1
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Convert Copy/Paste VBA to Macro without Copy/Paste

    How would I go about converting this macro into a macro that doesn't use a copy/paste in it (for obvious reasons)

    Please Login or Register  to view this content.
    Also, I couldn't get Paste Special to work either which I was trying to, kept throwing an error.

    Thanks.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    I would try this, but not possible to test without your file.
    Please Login or Register  to view this content.
    I also discourage using ActiveSheet; better to refer directly to desired sheet, unless you can call this macro from different active sheets.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    Ahhh awesome thank you kindly! Will test it out now.

    It threw me an error "Object variable or With block variable not set. (Happens if I filter out all but one row)

    On this line:
    Please Login or Register  to view this content.
    I guess I forgot to mention, I am copying sorted data, this code copies hidden rows as well, I need to copy only visible rows.
    Last edited by NewYears1978; 07-13-2018 at 04:29 PM.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    I am not sure what is causing that error. Is it possible for you to attach your file?

    The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.

  5. #5
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    It's full of customer data so I can't attach it =D

    The error only happens if I filter to one row, which is not something we would ever be doing so that is okay. But do you know how to make it copy only the visible rows (from filtering) instead of all the rows?

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste


    As the Range.Copy method only copy the visible cells …

  7. #7
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    That's weird because it is copying everything on the page not just the filtered visible items.
    Let me make a sample without all my data in it so I can attach it.

    Edit
    Okay - attached,(Macro is on the Customer List Tab, last item Mail Merge icon)

    BTW the "single item" bug is gone, must have been a typo I had made or something.
    Attached Files Attached Files
    Last edited by NewYears1978; 07-16-2018 at 11:16 AM.

  8. #8
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    Anyone have any idea on this..I still could never figure out how to make this copy ONLY the filtered data, it always copies everything.

    Please Login or Register  to view this content.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    This worked for me:
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Convert Copy/Paste VBA to Macro without Copy/Paste

    I am dumb. Thank you very much!

+ 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. Replies: 0
    Last Post: 01-13-2016, 08:50 PM
  2. Macro to Copy/Paste and Convert Cells to Number
    By switchblade13 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-05-2014, 05:38 PM
  3. [SOLVED] help refining this copy/paste IF AND statement macro (convert to a loop)?
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-11-2013, 05:30 AM
  4. [SOLVED] Simple copy and paste macro- Paste special help needed.
    By hernancrespo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 07:02 AM
  5. Macro to copy selected columns, convert to number and paste to new tab
    By Greed in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-06-2011, 06:11 PM
  6. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM
  7. convert sumproduct copy/paste to MACRO
    By kossdust in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2007, 01:42 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