Hi Guys,

I have a code below that I want to tweak a little. I want to change the reference of the cells where the values will be pasted. I want to change it to M46:M56. Also, I want to make this code so that the next time I run the code, it will overwrite the previously posted values.

Here's the code:


Sub Test()
    a = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row 'COUNT DATA ROWS
    For i = 2 To a
    If Worksheets("Sheet1").Cells(i, 3).Value = Worksheets("Sheet2").Range("F1") Then 'CRITERIA
        Worksheets("Sheet1").Cells(i, 1).Copy  '.CELLS(I,1) MEANS ROWS I AND COLUMN 1 (A:A)
        Worksheets("Sheet2").Activate
        b = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row 'this is where data will be pasted
        Worksheets("Sheet2").Cells(b + 1, 1).Select 'this is where data will be pasted
        ActiveSheet.Paste
    End If
    Next
        Application.CutCopyMode = False
        ThisWorkbook.Worksheets("Sheet2").Activate
        ThisWorkbook.Worksheets("Sheet2").Cells(1, 1).Select

End Sub