Reputation: 290
I have an excel workbook with 2 sheets 1 & 2. I am running some code to get the Sheet1 populated. Now in Sheet2 B1 cell I want the [Sheet1 last cell value in Column D] + 1.
Can anyone help me code this. Thanks in advance.
Upvotes: 0
Views: 858
Reputation: 96753
This will capture the last value in column D of Sheet1
Sub DataCapture()
Dim N As Long, V As Variant
With Sheets("Sheet1")
N = .Cells(Rows.Count, "D").End(xlUp).Row
V = .Cells(N, "D").Value
End With
Sheets("Sheet2").Range("B1").Value = V
End Sub
Upvotes: 1