+ Reply to Thread
Results 1 to 6 of 6

Prevent a VBA wiping over specific columns when pasting into a new sheet

  1. #1
    Forum Contributor
    Join Date
    11-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    126

    Prevent a VBA wiping over specific columns when pasting into a new sheet

    Hi all,

    I am using the below VBA to look for certain criteria in the column of one tab and depending what value is in each row it will paste into a separate spreadsheet. The VBA is working really well, the only problem I have is that as it is pasting the whole row it is copying over columns that I have data in that needs to remain there. Is there a work around to this VBA?

    If it helps I only need to copy the first 5 columns of the main sheet into the corresponding tabs.

    Please Login or Register  to view this content.
    Last edited by elleb; 05-18-2017 at 01:53 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Prevent a VBA wiping over specific columns when pasting into a new sheet

    Possibly,
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    126

    Re: Prevent a VBA wiping over specific columns when pasting into a new sheet

    Hi,

    thanks for the reply, that appears to be throwing up a debug error, do I need to put lr2/lr3 anywhere?

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Prevent a VBA wiping over specific columns when pasting into a new sheet

    Change rows(r) to Range("A" & r).Resize(, 5).
    Last edited by JOHN H. DAVIS; 05-18-2017 at 09:57 AM.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Prevent a VBA wiping over specific columns when pasting into a new sheet

    The code was to replace

    Rows(r).Copy, you said you wanted to copy column A:E instead of the entire row.

  6. #6
    Forum Contributor
    Join Date
    11-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    126

    Re: Prevent a VBA wiping over specific columns when pasting into a new sheet

    Thanks for the reply, apologies Davesexcel figured out shortly after replying - as you said I was putting it in the wrong part of the code.

    Thanks for the help.

+ 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. Pasting values in specific columns
    By greengirl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2014, 12:11 AM
  2. Prevent users from deleting complete rows and specific columns
    By vonrainer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2014, 06:09 AM
  3. [SOLVED] Copy data from Specific columns from a csv file and pasting it in the Active sheet
    By Pavan Renjal in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-01-2014, 12:14 PM
  4. Macro to prevent printing specific sheet based on cell value in another sheet
    By dbrady01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2013, 04:23 PM
  5. Replies: 9
    Last Post: 05-13-2013, 05:43 AM
  6. [SOLVED] Need help !!Moving a row from one sheet to another without wiping out existing row.
    By mmccra2858 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-02-2012, 06:37 AM
  7. [SOLVED] can you prevent viewing of specific columns in a worksheet
    By Tamara in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-19-2005, 01:06 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