So I am currently writing a piece of code that moves a block of data from one spreadsheet to another. Once it is moved the code allocates a numerical reference for the block.
At the moment the code goes to the bottom of the page and work up until it finds the last written line. It reads that reference and adds 1 to it.
I thought this would solve the issue but it's actually created another.
Now it means that if the last row is removed or posted to another sheet, the code will then create a duplicate of that reference.
For example if I had a sheet with 45 rows, going from 10001 to 10045 in references, and I then moved row 10045 to another sheet. The next time I run the code I will end up with a second 10045.
Is there any way I can make this code into a variable that stays at the same amount, regardless of which numbers have been removed?
See the code I've been using below.
BlankRow = Range("B1000").End(xlUp).Row + 1
Cells(BlankRow, 2).Select
ActiveCell.Value = Selection.Offset(-1, 0) + 1
EDIT: To make it clearer. The movement of data is to another spreadsheet in the same workbook. I am not transferring to another workbook completely
The Information is pulled from another spreadsheet which is a basic mock up of a form. Press a button and it's formatted here.
This is where the references come in (B). Currently it adds one each time. However, one a job is complete the entire row of data is moved through case to another sheet - think of it as a glorified to do list.
However, if the bottom row's job (10058) moves to another sheet we get a problem. When the new set of data is being put in the code provided above will see what the last row is numbered and add one. (This would see 10057 and add one, thus making 10058 again). How do I avoid this?