1

I'm working on a project right now and am adding the finishing touches. In short, I have the user copy a worksheet, click my macro button, and have my program do the rest. I'm running into an error where selecting the entire sheet (blank cells and all) to copy to clipboard causes "activesheet.paste" to give an error. To fix this, I have been selecting only cells filled with data and my problem goes away. However, I'm trying to make this as user friendly as possible and in order to do so, am trying to allow the user to copy the entire spreadsheet and have my macro eliminate the empty cells before pasting again. I'm not quite sure if this is possible, but I would greatly appreciate any help I can get. Thanks!

part that's giving me trouble:

Range("A4").Select
On Error Resume Next
ActiveSheet.Paste
If Err Then
    MsgBox "Clipboard is empty, restart macro.": Err.Clear this line
    End
End If
YowE3K
  • 23,852
  • 7
  • 26
  • 40
satincorvo
  • 173
  • 1
  • 2
  • 12
  • Possible [duplicate](https://stackoverflow.com/questions/35595258/how-to-check-if-clipboard-is-empty-of-text) – Peter Schneider Jun 05 '17 at 18:51
  • I must have worded OP wrong. I simply return that error via msgbox because it gives a similar error for both an empty clipboard, and a clipboard that contains a lot of blank cells. The clipboard scenario is basically range a4:g500 of cells containing data and the rest is empty cells. I hope that makes sense. – satincorvo Jun 05 '17 at 18:56

0 Answers0