albertc30
Well-known Member
- Joined
- May 7, 2012
- Messages
- 1,091
- Office Version
- 2019
- Platform
- Windows
Hi all.
I hope this post will find you all in good health and having a greta weekend thus far.
I am now working on making my crypto excel sheets more automated and, as usual I have come to a wall.
I have managed the code bellow to copy the last row of current sheet and have it added to a sheet called AllBuys.
Now the issue is that on collumn there's an ID number that the macro should cross reference to see if the last line has already been copied.
At the moment it's not doing any validation and it just repeatedly adds the data onto the AllBuys sheet.
How do I go about making sure the macro looks for the data in collumn B on AllBuys and if it finds the same value it returns a "Line already copied msg!".
Also, I don't need to copy the entire row, only data from collumn A though collumn L.
Any advise is much appreciated as always.
Kind regards,
Albert.
I hope this post will find you all in good health and having a greta weekend thus far.
I am now working on making my crypto excel sheets more automated and, as usual I have come to a wall.
I have managed the code bellow to copy the last row of current sheet and have it added to a sheet called AllBuys.
VBA Code:
Sub CopyRow()
Dim lastrowSrc As Long
Dim lastrowDest As Long
'Get last row of data
lastrowSrc = Sheets("Coinbase").Range("A" & Rows.Count).End(xlUp).Row
'Get first blank row (last row of data +1)
lastrowDest = Sheets("AllBuys").Range("A" & Rows.Count).End(xlUp).Row + 1
'Copy row
Sheets("Coinbase").Range("A" & lastrowSrc).EntireRow.Copy Sheets("AllBuys").Range("A" & lastrowDest) 'I also wish not to copy the entire row but only till collumn L.
End Sub
Now the issue is that on collumn there's an ID number that the macro should cross reference to see if the last line has already been copied.
At the moment it's not doing any validation and it just repeatedly adds the data onto the AllBuys sheet.
How do I go about making sure the macro looks for the data in collumn B on AllBuys and if it finds the same value it returns a "Line already copied msg!".
Also, I don't need to copy the entire row, only data from collumn A though collumn L.
Any advise is much appreciated as always.
Kind regards,
Albert.