Glam Prestige Journal

Bright entertainment trends with youth appeal.

Sub CopyRowsWithNUMBER()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
Set Source = ActiveWorkbook.Worksheets("Completed Items")
Set Target = ActiveWorkbook.Worksheets("Week 24")
j = 15
For Each c In Source.Range("D1:D200") If c = "24" Then Source.Rows(c.Row).Copy Target.Rows(j) j = j + 1 End If
Next c
End Sub

This is my Code I need to know how to set this to paste my code to the first available row in the target sheet. Right now it is set to move it to row 15, I did this as a temporary workaround since that is in fact the current last row of my target data sheet but of course this will change.

0

1 Answer

Adapt the following lines to find first available row:

 Dim lastRow As Long 'Finds the last occupied cell on Column A. Change 1 to another number. B=2, D=4, E=5, etc lastRow = Cells(Rows.Count, 1).End(xlUp).Row 'Set value to +1 to get the next available row lastRow = lastRow + 1
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy