Quantcast
Viewing all articles
Browse latest Browse all 15714

[RESOLVED] Excel copy after probem

I have some code which opens a source workbook and assigns it to a wbSource object and opens a destination workbook and assigns it to a wbDest object.

My aim is then to copy some of the sheets from the source to destination workbook which I tried to do with this code but I get a "Copy method of Worksheet class failed" error message. Why???
Code:

    For Each ws In wbSource.Worksheets
        If Left(ws.Name, 3) = "tab" Then
            wbSource.Sheets(ws.Name).Copy After:=Workbooks(wbDest.Name).Sheets.Count
        End If
    Next


Viewing all articles
Browse latest Browse all 15714

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>