Results 1 to 2 of 2

Copy from one sheet and paste to another - overwrite all data

Threaded View

  1. #1
    Registered User
    Join Date
    04-09-2017
    Location
    Oakland, Ca
    MS-Off Ver
    2013
    Posts
    1

    Copy from one sheet and paste to another - overwrite all data

    I'm attempting to copy all rows from sheet "meowmix" that meet certain requirements paste those rows to sheet "woofmix".
    Ideally, I would like overwrite all row on "woofmix" ,except for the first row, with the copied rows from "meowmix".

    The below code successfully identifies rows with requirements and pastes them to the target sheet, however, it adds on to the target sheet rather than replacing. I'm not having an issue with suppressing the 'overwrite destination cells' dialogue box. I'm having and issue overwriting.

    Sub replacecurrentrows()
    Dim rngRow As Range, MEOW As Range, lngrow As Long
    Dim varCheckCol1 As Variant, varCheckCol2 As Variant, varCheckCol3 As Variant
    
    Set MEOW = Sheets("meowmix").Range("O2:P5000")
    
    
    
    For Each rngRow In MEOW.Rows
    
    
    
      varCheckCol1 = rngRow.Value2(1, 1) 'col O
      varCheckCol2 = rngRow.Value2(1, 2) 'col P
      'varCheckCol3 = rngRow.Value2(1, 5) 'col Q
    
      If varCheckCol1 = "Kibbles" And varCheckCol2 = "Bits" Then
      If rngRow Is Nothing Then
        rngRow.EntireRow.Copy
        Sheets("Woofmix").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
        
        
    End If
    Next
    
    End Sub
    Last edited by AliGW; 04-09-2017 at 04:02 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Deleted
    By MaxStrong in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2015, 01:50 AM
  2. Copy and paste to new worksheet but overwrite if data already exists.
    By digimon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2015, 11:17 PM
  3. Need to paste only specific row to another sheet without overwrite
    By indranildreams in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2014, 06:15 AM
  4. [SOLVED] Copy/Paste from a Filtered Range and Insert copied data NOT overwrite
    By Simon.Ward in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-12-2013, 11:14 AM
  5. Copy and Paste from an AutoFilter but Insert rows not Overwrite
    By Simon.Ward in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2013, 12:43 PM
  6. Copy and Paste Overwrite Extension
    By ljrezn in forum Excel General
    Replies: 0
    Last Post: 06-24-2011, 01:13 PM
  7. [SOLVED] Sub to copy a target sheet from slaves from and paste/overwrite into master
    By Max in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 06-13-2005, 10:05 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