PasteSpecial method of Range class failed in for loop

Refresh

February 2019

Views

5 time

0

Writing macros to copy cells in a different workbook in a specific format.Getting error at different lines everytime I run the code

I tried with unhide cells, selection

`For i = 1 To lastrow If IsEmpty(ThisWorkbook.Sheets("Summary").Range("A" & i).Value) = False Then If ThisWorkbook.Sheets("Summary").Range("A" & i).Font.Bold = True Then 'Range("A" & i).Copy Range("B" & i) Set BoldTitle = ThisWorkbook.Sheets("Summary").Range("A" & i) x = i Else ws.Range("A" & i).Value = "Winter I"

            BoldTitle.Copy
            ws.Range("B" & i).PasteSpecial xlPasteValues

            ThisWorkbook.Sheets("Summary").Range("A" & i).Copy
            ws.Range("C" & i).PasteSpecial xlPasteValues

           ThisWorkbook.Sheets("Summary").Range("B" & i).Copy
            ws.Range("D" & i).PasteSpecial xlPasteValues

            ThisWorkbook.Sheets("Summary").Range("C" & i).Copy
            ws.Range("E" & i).PasteSpecial xlPasteValues

            ThisWorkbook.Sheets("Summary").Range("D" & i).Copy
            ws.Range("F" & i).PasteSpecial xlPasteValues
        End If
    Else
    End If
Next i

`

0 answers