Hi, I have problem with my macro code. I want to copy only values from Worksheet A (in which in cells are formulas) to Worksheet B to next empty cell. Any help will be appreciated.
My code below, which doesn't work:
Sub CrossCheck()
Dim Lastrow, i As Long
Lastrow = Range("B" & Rows.Count).End(xlUp).Row
LastRow1 = Sheets("CrossCheck").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Input").Activate
For i = 5 To Lastrow
If Range("B" & i).Value = "ABC" And Range("D" & i).Value = "X" Then
Range("C" & i).Copy Sheets("Sheet2").Cells(LastRow1, "A").PasteSpecial, xlPasteValues
End If
Next i
End Sub
My code below, which doesn't work:
Sub CrossCheck()
Dim Lastrow, i As Long
Lastrow = Range("B" & Rows.Count).End(xlUp).Row
LastRow1 = Sheets("CrossCheck").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Input").Activate
For i = 5 To Lastrow
If Range("B" & i).Value = "ABC" And Range("D" & i).Value = "X" Then
Range("C" & i).Copy Sheets("Sheet2").Cells(LastRow1, "A").PasteSpecial, xlPasteValues
End If
Next i
End Sub