+ Reply to Thread
Results 1 to 2 of 2

Copy values from another sheet based on criteria

  1. #1
    Registered User
    Join Date
    11-26-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    12

    Copy values from another sheet based on criteria

    Hi I am trying to create a file where there are two sheets
    MAIN and DATA
    ion the data sheet I will have the student data and their partecipation
    Name Date Ammount of times.

    This sheet is updated with new data each month keeping the old ones.

    On the other sheet MAIN I have a module:
    Sub klient_Click()
    Dim ws As Worksheet

    Application.ScreenUpdating = False

    For Each ws In Worksheets
    If ws.Name <> "DATA" Then
    With Sheets("DATA")
    .Range("B2").AutoFilter field:=7, Criteria1:=ws.Name
    .AutoFilter.Range.Offset(1).Copy ws.Range("D10")
    .ShowAllData
    End With
    End If
    Next ws
    Sheets("DATA").AutoFilterMode = False

    Application.ScreenUpdating = True
    End Sub
    How can I make that in the MAIN I will copy Only the newly imported data based for ex on the first line of the newly copied data i the DATA sheet.
    To make it easy : ON the DATA sheet I have February data, I am today importing there MARCG data.
    And via my Sub klient_Click() I will copy into Main only the data I just imported and not the whole sheet again.

    Any ideas?

    Thanks

    Webisti

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,990

    Re: Copy values from another sheet based on criteria

    I'm having real trouble trying to understand what you're wanting to do. I THINK what you're saying is that the current macro copies the whole sheet, and you just want to copy the autofiltered section. Is that correct? If so, you need to use the special cells property to only copy the autofiltered range by changing this line:
    Please Login or Register  to view this content.
    to this line:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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