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:
Bookmarks