Results 1 to 11 of 11

VBA - if three criterias match then copy/paste matching row value to another sheet

Threaded View

  1. #1
    Registered User
    Join Date
    03-08-2019
    Location
    Estonia
    MS-Off Ver
    MS Office 360
    Posts
    19

    VBA - if three criterias match then copy/paste matching row value to another sheet

    Hello, I've problem with the code that is shown below. The thing is that I have criteria brought out in one sheet which contains three values.

    Criterias in range of: sheets("Klaaside valik").range("A3:A11")

    matching values in range of: sheets("Sheet1").range("B3:D7")

    If all criterias match then I would like to have printed matching row value from column A to sheets("Klaaside valik").range("A14:A")

    The code I've written:
    Option Explicit
    
    Sub copypaste()
    
    Dim x As String
    Dim y As Integer
    Dim z As Integer
        Dim w As Integer
        Dim h As Integer
    Dim i As Integer
    
    x = Sheets("Klaaside valik").Range("A3:A11").Value
    y = Sheets("Klaaside valik").Range("B3:B11").Value
    z = Sheets("Klaaside valik").Range("C3:C11").Value
    
    finalrow = Sheets("Sheet1").Range("B200").End(xlUp).Row
    
    For i = 3 To finalrow
    
        If Worksheets("Sheet1").Cells(i, 2) = x And Worksheets("Sheet1").Cells(i, 3) <= y And Worksheets("Sheet1").Cells(i, 4) <= z Then
            Worksheets("Sheet1").Range(Cells(i, 1)).Copy
            Worksheets("Klaaside valik").Range("A14:A200").PasteSpecial xlPasteFormulasAndNumberFormats
            
            End If
    
    Next i
    
    End Sub
    Example file:
    Last edited by VBwArrior; 04-23-2019 at 06:06 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA - copy paste specific values to range when 3 criterias match
    By VBwArrior in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2019, 08:48 AM
  2. Replies: 1
    Last Post: 10-06-2017, 05:02 PM
  3. Macro: Copy/cut all rows matching criteria, and paste into specific Table/sheet
    By Andrewjs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2017, 03:55 PM
  4. [SOLVED] Userform for date entry and then copy/paste matching data to another sheet
    By nymanns in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 03:22 AM
  5. Replies: 1
    Last Post: 01-17-2013, 05:27 PM
  6. Copy Paste data with matching criteria from different sheet
    By Noor Hussain in forum Excel General
    Replies: 0
    Last Post: 06-14-2012, 01:23 AM
  7. VBA Search workbook for user value, copy/paste entire row to last sheet for matching
    By jasonkrispy21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2012, 03:42 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