Hi,
I have two lists on two separate sheets and I am trying to append one list (ws6) to the other (ws). It should copy the relevant ranges per row in sheet ws6 and paste them into the relevant columns in sheet ws. Then it should add in two values on two columns to each appended row in sheet ws. The code I have so far is not working. I think I need to put the 'i' in the coding lines which copy the data but I don't know how to get this right.
I'd be very grateful for any help on this. Here is my code:
I have two lists on two separate sheets and I am trying to append one list (ws6) to the other (ws). It should copy the relevant ranges per row in sheet ws6 and paste them into the relevant columns in sheet ws. Then it should add in two values on two columns to each appended row in sheet ws. The code I have so far is not working. I think I need to put the 'i' in the coding lines which copy the data but I don't know how to get this right.
I'd be very grateful for any help on this. Here is my code:
Code:
Public Sub Append_unverified_Insurance_extract()
'This sub appends new unverified insurance data records from the 'Insurance Data - unverified' sheet into the 'Students Overseas' sheet
Dim ws As Worksheet
Dim ws6 As Worksheet
Dim Cell As Range
Set ws = ThisWorkbook.Sheets("Students Overseas")
Set ws6 = ThisWorkbook.Sheets("Insurance Data - unverified")
Finalrow = Sheets("Insurance Data - unverified").Range("A5000").End(xlUp).Row
Application.ScreenUpdating = False
With ws6
For i = 5 To Finalrow
Cell.Offset(, 0).Resize(, 2).Copy ' Copy Faculty and Dept
ws.Range("A5000").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Cell.Offset(, 6).Resize(, 4).Copy ' Copy forename, surname, ID and SSN
ws.Range("A5000").End(xlUp).Offset(1, 3).PasteSpecial xlPasteValues
Cell.Offset(, 2).Resize(, 4).Copy ' Copy Acad period, Aos code, Aos period and Course title
ws.Range("A5000").End(xlUp).Offset(1, 7).PasteSpecial xlPasteValues
Cell.Offset(, 12).Copy ' Copy city
ws.Range("A5000").End(xlUp).Offset(1, 19).PasteSpecial xlPasteValues
Cell.Offset(, 13).Copy ' Copy country
ws.Range("A5000").End(xlUp).Offset(1, 21).PasteSpecial xlPasteValues
Cell.Offset(, 10).Resize(, 2).Copy ' Copy travel start date and travel end date
ws.Range("A5000").End(xlUp).Offset(1, 34).PasteSpecial xlPasteValues
Cell.Offset(, 15).Copy ' Copy trip approved by
ws.Range("A5000").End(xlUp).Offset(1, 46).PasteSpecial xlPasteValues
Cell.Offset(, 17).Resize(, 2).Copy ' Copy purpose of trip & stage code
ws.Range("A5000").End(xlUp).Offset(1, 52).PasteSpecial xlPasteValues
'And add in extra values to placement type and Record added by columns in 'Students Overseas' sheet:
ws.Range("A5000").End(xlUp).Offset(1, 53).Value = "Insurance application"
ws.Range("A5000").End(xlUp).Offset(1, 0).Value = "Insurance application - unverified"
Next i
End With
Application.ScreenUpdating = True
End Sub