A very good evening to you.
"But I don't understand what it is doing, if you know the range why do you have to find it?"
I know one range - the destination. I don't know the source range - the last (in fact two last) rows in the list.
I have a list to which lines are added at the bottom by VBA. The number of lines on the list is finite. Occasionally an item somewhere on the list has to be deleted. I have a button beside each line which will allow the user to do this as the Worksheet is protected and I don't want the user to have access to a heavily formatted page. (etc., etc)
However for security reasons the list must not have any blank spaces, and as the sheet is heavily formatted both for use and for printing, I can't just delete the row(s) (which also have data in hidden columns further to the right).
So my solution is to add some code to the button beside each line which after clearing the contents, will then take the last item on the list, cut it, and paste it in the newly created empty line.
Did I explain that clearly? And if you come back to me and say "Well why didn't you simply.....", then you could well be responsible for my final descent into madness.
"The Cut code is Range expression.Cut so what is the Range("A12:Y12") doing?".
At least in the Excel 2002 version that I'm using, the 'Range("A12:Y12") (as used in my test) is the destination when using the 'Cut' command. I quote:
"Cut Method
Cuts the object to the Clipboard or pastes it into a specified destination.
expression.Cut(Destination)
expression Required. An expression that returns an object in the Applies To list.
Destination Optional
Variant. Used only with
Range objects. The range where the object should be pasted. If this argument is omitted, the object is cut to the Clipboard."
So the Range("A12:Y12") would be changed to the appropriate range for each line deleted.
Did I explain that clearly enough?