Hello everyone,
i have datea to be copied and paste to another sheet according to the value. However, i made the code but it will overwrite the old data if i continue on another sheet. How to avoid it ?
Sub Copy()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
' Change worksheet designations as needed
Set Source = ActiveWorkbook.Worksheets("sheet1")
Set Target = ActiveWorkbook.Worksheets("sheet2")
j = 1 ' Start copying to row 1 in target sheet
For Each c In Source.Range("I1:I1000") ' Do 1000 rows
If c = "Closed" Then
Source.Rows(c.Row).Copy Target.Rows(j)
Source.Rows(c.Row).Cut Target.Rows(j)
j = j + 1
End If
Next c
End Sub
i have datea to be copied and paste to another sheet according to the value. However, i made the code but it will overwrite the old data if i continue on another sheet. How to avoid it ?
Sub Copy()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
' Change worksheet designations as needed
Set Source = ActiveWorkbook.Worksheets("sheet1")
Set Target = ActiveWorkbook.Worksheets("sheet2")
j = 1 ' Start copying to row 1 in target sheet
For Each c In Source.Range("I1:I1000") ' Do 1000 rows
If c = "Closed" Then
Source.Rows(c.Row).Copy Target.Rows(j)
Source.Rows(c.Row).Cut Target.Rows(j)
j = j + 1
End If
Next c
End Sub