Results 1 to 2 of 2

Copy cells in a column based on a specific criteria into another column

Threaded View

excelgeek1234 Copy cells in a column based... 06-20-2017, 04:00 PM
alansidman Re: Copy cells in a column... 06-20-2017, 04:21 PM
  1. #1
    Registered User
    Join Date
    06-20-2017
    Location
    New York, NY
    MS-Off Ver
    2016
    Posts
    5

    Copy cells in a column based on a specific criteria into another column

    I have two worksheets, "Signed" and "April". I want to copy Column "Y" from "Signed" based on certain criteria into column "A" starting from the next available/blank row. ( so right under the existing data).
    My criteria for column Y is that if column L = month of cell "D2" from "April" AND the year of cell "D2" from "ApriL"...( so right now D2 is 4/30/2017).. then copy that cell in the next available row of Col A of "April" and keep adding on.
    my code is as follows:


    Dim sourceSht As Worksheet
    Dim myrange As Range
    Dim DestRow As Integer
    Dim ws2 as Worksheet
    
    Range("D3").Select
    ActiveCell.FormulaR1C1 ="=MONTH(R[-1]C)"
    Range("D3").Select
    Selection.NumberFormat ="General"
    MonthVal = ActiveCell.Value
    
    
    
    
    
    Set sourceSht = ThisWorkbook.Worksheets("Signed")
    Set myrange = sourceSht.Range("Y1", Range("Y" & Rows.Count).End(xlUp))
    Set ws2 = Sheets(NewSheet)
    DestRow = ws2.Cells(Rows.Count,"A").End(xlUp).Row + 1
    
    
    For each rw in myrange.Rows
    If rw.Cells(12).Value = Month(Range("D2")) Then
    myrange.Value.Copy Destinations:=Sheets(ws2).Range("A" & DestRow)
    
    
    End If
    Last edited by alansidman; 06-20-2017 at 04:21 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy Cells to Different Sheets based on a criteria column
    By tahlzair in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-08-2017, 08:48 PM
  2. [SOLVED] VBA - Copy and Paste data based on two criteria to specific start row and column
    By ndgo10 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-02-2014, 09:15 AM
  3. Replies: 0
    Last Post: 07-16-2013, 05:22 AM
  4. [SOLVED] Copy Cells In One Column Based On Criteria In Another Column
    By hgteros in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-14-2012, 06:07 PM
  5. Extracting data from column based on specific criteria and pasting into new column
    By vanvalkenburg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2012, 10:26 PM
  6. Copy Cells to another sheet based column criteria
    By Newfibot in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2011, 01:29 PM
  7. Copy Cells into Blank Invoice Based on Row and Column Criteria
    By alton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2010, 12:49 PM

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