samedi 29 décembre 2018

How do i create unique updating list if criterie is met in another worksheet?

So i want to copy a certain range of coloumns to another worksheet if certain criterias are met with a comman button. Namely if D36:D160 is "Fælles" or "Lagt ud" then coloumns A:H in this region should be copied to another worksheet in the workbook in the same region. However, it has to go in the first blank space and be the unique values. Worksheet "Stig Jan"

Worksheet "Laura Jan"

As the list is updating it has to copy to the other without copying the same data.

Please bear in mind that i am just a humble carpenter making a budget for me and my partner in my spare time. I have tried looking for similiar questions and lessons on here and youtube, but haven't found the soulution.

Private Sub CommandButton1_Click() A = Worksheets("Stig Jan").Cells(Rows.Count, 1).End(xlUp).Row

For i = 34 To A

If Worksheets("Stig Jan").Cells(i, 4).Value = "Fælles" Then

Worksheets("Stig Jan").Rows(i).Columns("A:H").Copy

Worksheets("Laura Jan").Activate

b = Worksheets("Laura Jan").Cells(Rows.Count, 1).End(xlUp).Row

Worksheets("Laura Jan").Cells(b + 1, 1).Select

ActiveSheet.Paste

Worksheets("Stig Jan").Activate

End If

Next

End Sub

I have succesfully been able to copy it to the other area if the "Fælles" criteria is met. I don't know how to add the "Lagt ud" criteria. And then when i click the the button it just copies the same values over and over again.

I hope you understand my question.

Thank you for taking your time to read this! :)

Aucun commentaire:

Enregistrer un commentaire