Attendance append not working

roy00a4

New Member
Joined
Mar 15, 2016
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

Its been a while since my last visit. I have been working on the my VBA skills. I have a workbook with two sheets. I have written a code to append the data from one sheet to the other. But it is not working as desired. Any help or suggestion related to the issue is much appreciated.

Code:
Private Sub CommandButton1_Click()
Dim loLastRow As Long


Worksheets("Att_Entry").Range("C8:C107").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("A" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("D8:D107").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("B" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("E8:E107").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("C" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("E3").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("D" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("F8:F107").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("E" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("G8:G107").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("F" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("I3").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("G" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("H7").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("H" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


Worksheets("Att_Entry").Range("H8:H107").Copy


With Worksheets("Template")
   loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
   .Range("I" & loLastRow).PasteSpecial Paste:=xlPasteValues
End With


MsgBox "Your Attendance Is Uploaded"


End Sub

>>This is how I want the data to be pasted
A IDEmp CodeNameCurrent SupervisorProcessRoleAttendance Updated ByDateAtt
A134307889707Tseng Mei FongFerdinand AnthonyWeb Chat LithiumTMAbhishek Roy43230PD
A1356941275595Tonmoy MitraWeb Chat LithiumTMAbhishek Roy43230PD
A127620911236Sunit SinhaWeb Chat Billing 1TMAbhishek Roy43230PD
A1396561226133Sugata ChatterjeeWeb Chat Billing 1TMAbhishek Roy43230PD
A1401431394819Sudeepta PaulWeb Chat Billing 1TMAbhishek Roy43230PD
A1307671023977Subhadeep DasWeb Chat Billing 1TMAbhishek Roy43230PD
A135228864579Soumik MallickWeb Chat Billing 1TrainerAbhishek Roy43230PD
A130907725298Samrat BiswasWeb Chat Billing 1PCAbhishek Roy43230PD
A1307531023651Roshni SahaWeb Chat Billing 1TMAbhishek Roy43230PD
A1401421391593Rajbir SinghWeb Chat Billing 1TMAbhishek Roy43230PD
A122047750883Puja GhoshWeb Chat Billing 1TMAbhishek Roy43230PN
A1396601392558Prapti KhanWeb Chat Billing 1TMAbhishek Roy43230PN
A1385811368617Lipika MahanandiaWeb Chat Billing 1TMAbhishek Roy43230PN
A1390941386023Kakoli MandalWeb Chat Billing 1TMAbhishek Roy43230PN
A1362721311031I****a BhowmickWeb Chat Billing 1TMAbhishek Roy43230PN
A1307521023608Ishika MondalWeb Chat Billing 1TMAbhishek Roy43230PN
A1396591392281Ila SinghWeb Chat LithiumTMAbhishek Roy43230PN
A1307611023820Dipyaman RoyWeb Chat Billing 1TMAbhishek Roy43230PN
A401102482184Dibyendu ChakravortyWeb Chat Billing 1TMAbhishek Roy43230PN
A1385801364106Biswajit DuttaWeb Chat Billing 1TMAbhishek Roy43230PN
>>This is how its coming .. Rest of it is way at the end almost
A IDEmp CodeNameCurrent SupervisorProcessRoleAttendance Updated ByDateAtt
A134307889707Tseng Mei Fong
A1356941275595Tonmoy Mitra
A127620911236Sunit Sinha
A1396561226133Sugata Chatterjee
A1401431394819Sudeepta Paul
A1307671023977Subhadeep Das
A135228864579Soumik Mallick
A130907725298Samrat Biswas
A1307531023651Roshni Saha
A1401421391593Rajbir Singh
A122047750883Puja Ghosh
A1396601392558Prapti Khan
A1385811368617Lipika Mahanandia
A1390941386023Kakoli Mandal
A1362721311031I****a Bhowmick
A1307521023608Ishika Mondal
A1396591392281Ila Singh
A1307611023820Dipyaman Roy
A401102482184Dibyendu Chakravorty
A1385801364106Biswajit Dutta
Ferdinand AnthonyWeb Chat LithiumTMAbhishek Roy43230PD
Web Chat LithiumTMPD
Web Chat Billing 1TMPD
Web Chat Billing 1TMPD
Web Chat Billing 1TMPD
Web Chat Billing 1TMPD
Web Chat Billing 1TrainerPD
Web Chat Billing 1PCPD
Web Chat Billing 1TMPD
Web Chat Billing 1TMPD
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN
Web Chat LithiumTMPN
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN
Web Chat Billing 1TMPN

<colgroup><col span="9"></colgroup><tbody>
</tbody>
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You showed us what you wanted the copied data to look like but you have not showed us what the source data looks like. That said, see if this gets you any closer to what you want.

Code:
Private Sub CommandButton1_Click()
    
    Dim att
    Dim loLastRow As Long


    att = Worksheets("Att_Entry").Range("C8:K107")
    With Worksheets("Template")
        loLastRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
        .Range("A" & loLastRow).Resize(UBound(att, 1), UBound(att, 2)) = att
        .Range("D" & loLastRow + 1 & ":D" & loLastRow + UBound(att) - 1).ClearContents
    End With


End Sub
 
Upvote 0
Hi igold

Thank you for your quick reply. My apologies for missing that.

Below is the sample form from where the data is sourced

Attendance ForFerdinand AnthonyAttendance Opened ByAbhishek Roy
A IDEmp CodeNameProcessRole10-May-18
A12451234567Tseng Mei FongBillTMPD
A12451234567Tonmoy MitraBillTMPD
A12451234567Sunit SinhaBillTMPD
A12451234567Sugata ChatterjeeBillTMPD
A12451234567Sudeepta PaulBillTMPD
A12451234567Subhadeep DasBillTMPD
A12451234567Soumik MallickBillTrainerPD
A12451234567Samrat BiswasBillPCPD
A12451234567Roshni SahaBillTMPD
A12451234567Rajbir SinghBillTMPD
A12451234567Puja GhoshBillTMPN
A12451234567Prapti KhanBillTMPN
A12451234567Lipika MahanandiaBillTMPN
A12451234567Kakoli MandalBillTMPN
A12451234567I****a BhowmickBillTMPN
A12451234567Ishika MondalBillTMPN
A12451234567Ila SinghBillTMPN
A12451234567Dipyaman RoyBillTMPN
A12451234567Dibyendu ChakravortyBillTMPN
A12451234567Biswajit DuttaBillTMPN

<colgroup><col><col><col><col><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Hi,

Your source data and your destination data are different. In your source data under the "Process" heading you have "Bill", yet in the destination data, "Bill" has been converted to either "Web Chat Billing 1" or "Web Chat Lithium".

Also if you could provide me with Row and Column numbers of your source data it would be a little easier. I am pretty sure I have them figured out but a double check with what you have would be nice.
 
Upvote 0

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top