Hi,

I have copied data from one excel to another (workbook).
I want to insert a blank row after a sepcific condition is met.

This is my code:

Sub CopyData()

Dim wbSource As Workbook
Dim wbDestination As Workbook

'open the source workbook and select the source sheet
Set wbSource = Workbooks.Open( _
Filename:="C:\Users\yadavarc\Documents\userdata\F_12.xls")

'Set the destition workbook variable
Set wbDestination = Workbooks.Open("C:\Users\yadavarc\Documents\userdata\Wales_VAT_P12.xls")

'copy the source range
wbSource.Sheets("F_12").Range("B:J").Copy

'paste the value at E9
wbDestination.Sheets("F_12 P12").Range("B:J").PasteSpecial (xlPasteValues)

Application.CutCopyMode = False

ActiveWorkbook.Save

End Sub


In my excel, values in column B remains same, value in column C changes.
ie. In column C we will have values like A0, A1,A2

The data will like below:
Column B Column C
AA A0
AA A0
AA A0
AA A0
AA A0
AA A0
AA A0
AA A0
AA A1
AA A1
AA A1
AA A1
AA A1
AA A1
AA A1
AA A1
AA A2
AA A2
AA A2
AA A2
AA A2
AA A2
AA A2
AA A2


so if value in column B is AA and value in column reaches end of A0 then a new blank row should be inserted.

similary for A1, A2 and so on.

Regards,