How to get rid of a persistent clipboard error?

283 Views Asked by At

I'm really new to VBA so please be really specific with your answer.

The code I've written does a lot of copy and paste functions. Every time I run the code, I get a pop-up box telling me that I have a Clipboard error:

We couldn't copy the content to the clipboard because it's in use by another application. You can still paste your content within this workbook, but it won't be available in other applications.

Clipboard error

I have tried Application.CutCopyMode = False and Call ClearClipboard after copying but I still get the message.

This is one of the copy code routines. It just copies the contents of one worksheet to another, in different workbooks:

For Each cell In destinationWorksheet.Range("A1").CurrentRegion
    cell.Value = CStr(cell.Value)
Next cell

And this is the other copy code routine, which does a column by column copy in different workbooks:

sourceColumn = 0
For i = 1 To sourceSheet.Cells(1, sourceSheet.columns.Count).End(xlToLeft).Column
    If sourceSheet.Cells(1, i).Value = sourceColumnName Then
        sourceColumn = i
        Exit For
    End If
Next i
0

There are 0 best solutions below