+ Reply to Thread
Results 1 to 4 of 4

Copy Clear and Paste

  1. #1
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Copy Clear and Paste

    I am looking for a code to:

    1. Copy from SourceData only if Manager is "Blake".
    2. Clear Destination table from row 2.
    3. Paste clipboard into 2nd row of Destination table.
    4. Clear clipboard.

    Note: SourceData table row number could change. The manager names will always be sorted together.

    Thanks
    Attached Files Attached Files

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

    Cool Try this !


    According to your attachment an Excel basics VBA demonstration as a beginner starter :

    PHP Code: 
    Sub Demo1()
        
    With Sheet1.ListObjects(2)
            .
    HeaderRowRange = .Parent.ListObjects(1).HeaderRowRange.Value
             
    If .ListRows.Count Then .DataBodyRange.Delete
            
    .ListRows.Add
            
    .Parent.[CRI2].Formula "=C2=""Blake"""
            
    .Parent.ListObjects(1).Range.AdvancedFilter 2, .Parent.[CRI1:CRI2], .HeaderRowRange
            
    .Parent.[CRI2].Clear
            
    .Resize .Range.CurrentRegion
            
    .Range.Columns(3).AutoFit
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 02-19-2023 at 03:57 PM. Reason: optimization ...

  3. #3
    Registered User
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    94

    Re: Try this !

    What is CRI1?

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

    Arrow Re: Copy Clear and Paste


    Post #2 demonstration updated …

    CRI1 is a cell address. Read the Range.AdvancedFilter VBA help to understand …

+ 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. [SOLVED] Code to Copy & Paste/ Clear Range
    By Bart60 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-26-2019, 12:40 PM
  2. [SOLVED] Copy/paste data using checkbox-clear when unchckd & multiple selections paste in next cell
    By Staceymcw in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-02-2015, 12:09 AM
  3. VBA, Vlookup, Copy, Paste and Clear
    By pp84 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-19-2013, 02:22 PM
  4. Copy and paste to the next clear cell???!!!
    By Andrewsayerhpv in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-09-2010, 08:54 AM
  5. copy and paste to next clear row
    By lrm75uk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2010, 05:44 PM
  6. VBA clear, search, copy & paste
    By natbloomie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2010, 03:53 AM
  7. clear, copy and paste on different sheets
    By robbi100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-31-2008, 11:31 AM

Tags for this Thread

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