(Solved) – Macro copies cell values from some cells but not others

(solved)-–-macro-copies-cell-values-from-some-cells-but-not-others

I have been trying to make a macro which copies some values from some cells to others. I have some code which gets the next line in the table, and then it copies the cell values and pastes them into the table. This works for only half of the cells I wish to copy however. It copy and pastes the values from cells B4 and B5 but not F5 and F7 (see below)

Sub YesTrade()
    Dim lastRow As Long
    Dim currentDate As String

    currentDate = Date
    lastRow = Worksheets("Trades").Cells(Rows.Count, 1).End(xlUp).Row
    Worksheets("Trades").Cells(lastRow   1, 1).Value = Date

    Worksheets("Calculator").Range("B4").Copy Worksheets("Trades").Cells(lastRow   1, 2)
    Worksheets("Calculator").Range("B5").Copy Worksheets("Trades").Cells(lastRow   1, 3)
    Worksheets("Calculator").Range("F5").Copy Worksheets("Trades").Cells(lastRow   1, 4)
    Worksheets("Calculator").Range("F7").Copy Worksheets("Trades").Cells(lastRow   1, 5)
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *