The original code wasn't designed with copy/paste and cut/paste functionality in mind. The version below should (hopefully) be better. I created a UDF called FormText that returns the formula in a cell as text using the following:
I believe that Excel versions after excel 2010 have this function built in, called FORMULATEXT(), but I'm working with Excel 2010, so I had to create it. If you can use the natural formula, feel free to do so (though please note that there's one spot in the code below that uses 'FormText' as well). Regardless, using FormText(), I then used the following in A2 of the list sheet:
=IF(LEN($C2)<2,"",OFFSET(INDIRECT(MID(FormText($C2),2,FIND("$",FormText($C2),FIND("$",FormText($C2))+1)-2)&"3",TRUE),0,-3))
And in B2:
=IF(LEN($C2)<2,"",OFFSET(INDIRECT(MID(FormText($C2),2,100),TRUE),0,-1))
And D2:
=IF(LEN($C2)<2,"",OFFSET(INDIRECT(MID(FormText($C2),2,100),TRUE),0,9))
You can then fill all three formulas down as far as you think you'll need, and they should update automatically. I'm not thrilled about using both OFFSET and INDIRECT in each of these formulas, but there aren't many other formulas in your workbook so I'm optimistic that you won't experience any meaningful lag. The goal of using this setup is that it enables the code to focus on getting just the Ord# right, which made it easier to adapt to all of your different conditions. The event procedure used to do so is:
It should do the following:
- New Entry on wk sheet --> New line on list
- Change an entry --> the same line on list is updated with the changes
- delete an entry on wk sheet --> that line on list sheet appears cleared (it's actually a space, which acts as a placeholder). If you later enter new data in that same cell on the wk sheet, it should generate a new line.
- copy/paste an entry to another spot --> original entry on list sheet unchanged, new entry added on new line with new date
- cut/paste an entry to another spot --> the original entry on list sheet updates with the new date
I tried to enable the ability to copy/cut/delete multiple entries at once and it seems to be working, but this feature could use a bit more testing. Try toying with the attachment to see if it will do. I don't think it's my most efficient work, but it seems to be working for me. Give it a go:
Bookmarks