Object does not support this vba property

'Copy and Paste the format of table
        With wb.Sheets("Sheet1").UsedRange
            .Copy
        End With

        Set cell = ActiveSheet.Range("C" & Rows.Count).End(xlUp)
        cell.Offset(3, 3).Activate

        With wbTarget.Sheets(I).ActiveCell
            .PasteSpecial
        End With

      

In the third paragraph, this gives me an error. I want to paste the content that I have copied to activecell.

How can I fix this? thank

+3


source to share


1 answer


If I understand what you are trying to achieve with your code, I think ActiveSheet

also wbTarget.Sheets(I)

(hopefully).

So, replace:

Set cell = ActiveSheet.Range("C" & Rows.Count).End(xlUp)
cell.Offset(3, 3).Activate

With wbTarget.Sheets(I).ActiveCell
    .PasteSpecial
End With

      



FROM

With ActiveSheet
    Set cell = .Range("C" & .Rows.Count).End(xlUp)
    cell.Offset(3, 3).PasteSpecial
End With

      

Note . You must stay away from ActiveSheet

and use Worksheets("SheetName")

.

+2


source







All Articles