hi guys,
I'm new here so please forgive me if I have not posted accurately.
the source is table format.
I'm currently working on some code to copy paste an entire row to archived sheet based on a single column being filled in column I after the table headers from row 8
I have got the code to partially work but it either leaves behind empty rows if i cut or some of the copied data if i copy.
can someone please tell me where im going wrong. Haven't used vba since college 10 years ago so bit rusty
here is code I am using;
I'm new here so please forgive me if I have not posted accurately.
the source is table format.
I'm currently working on some code to copy paste an entire row to archived sheet based on a single column being filled in column I after the table headers from row 8
I have got the code to partially work but it either leaves behind empty rows if i cut or some of the copied data if i copy.
can someone please tell me where im going wrong. Haven't used vba since college 10 years ago so bit rusty
here is code I am using;
Code:
Private Sub CommandButton1_Click()
a = Worksheets("Current Workstack").Cells(Rows.Count, 1).End(xlUp).Row
For i = 8 To a
If Worksheets("Current workstack").Cells(i, 9).Value <> "" Then
Worksheets("Current Workstack").Rows(i).Cut
Worksheets("archived work").Activate
b = Worksheets("Archived Work").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Archived Work").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("Current Workstack").Activate
End If
Next i
For b = 1 To a
If Worksheets("Current workstack").Cells(b, 2) = "" Then
Worksheets("Current Workstack").Rows(b).EntireRow.Delete
End If
Next b
Application.CutCopyMode = False
End Sub