When you use your vba to clear cells or various other things it clears your clipboard.
As a work around to this (i have seen far more complex workarounds but they seem pretty "janky" and over complex - trying to keep it as simple as possible) I copy the clipboard into an addin so that i can retrieve it after performing the activity that would otherwise clear the clipboard.
Problem is that I may have done this previously and so I might have for example inserted a 2x2 set of data but i have previously used it for lets say a 3x2 one - when i retrieve all the data i get a 3 x 2 one (because I just grab all the data from the sheet) which means I have that extra data added. No good, as I want this to be robust.
Unfortunately clearing the old data is one of the things that clears the clipboard!
The obvious things that would solve this seem to be if I could tell the size of the data in the clipboard or tell the size of the data i just pasted in the addin. or maybe if there is another way to clear the sheet without clearing the clipboard.
Probably there is a simple solution
Bookmarks