I would like to copy some specific columns if criterias are met. Namely if the value in row 4 is "Fælles" and the text is NOT bold.
Please take a look at my code and tell me what i do wrong. I don't have much experience with coding or VBA.
Private Sub CommandButton1_Click()
A = Worksheets("Stig Okt").Cells(Rows.Count, 1).End(xlUp).Row
For i = 34 To A
Next
If Worksheets("Stig Okt").Cells(i, 4).Font.Bold = False And Cells(i, 4).Value = "Fælles" Then
Worksheets("Stig Okt").Rows(i).Columns("A:H").Copy
Worksheets("Laura Okt").Activate
b = Worksheets("Laura Okt").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Laura Okt").Cells(b + 1, 1).Select
ActiveSheet.Paste
End If
If Worksheets("Stig Okt").Cells(i, 4).Font.Bold = False And Cells(i, 4).Value = "Lagt ud" Then
Worksheets("Stig Okt").Rows(i).Columns("A:H").Copy
Worksheets("Laura Okt").Activate
b = Worksheets("Laura Okt").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Laura Okt").Cells(b + 1, 1).Select
ActiveSheet.Paste
End If
Worksheets("Stig Okt").Activate
End Sub
No error occours, but it doesn't really do anything and i don't understand why?
Aucun commentaire:
Enregistrer un commentaire