Good morning all,
I have data on 1 sheet that i want to copy and paste (clearing the data ) to another sheet. I wish to connect this macro to a "form control button" so when the operator is filling up the form, he clicks on the button for storage and the data will be moved. So far i have the current code for cut and paste which works well. Any suggestions on how to modify it? in the case below, the code works when triggered from the word "Closed" and i don't really need it now. Thank you.
I have data on 1 sheet that i want to copy and paste (clearing the data ) to another sheet. I wish to connect this macro to a "form control button" so when the operator is filling up the form, he clicks on the button for storage and the data will be moved. So far i have the current code for cut and paste which works well. Any suggestions on how to modify it? in the case below, the code works when triggered from the word "Closed" and i don't really need it now. Thank you.
VBA Code:
Sub Store()
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 = Target.Range("A" & Rows.Count).End(xlUp).Row + 1 ' Start copying 1 down from the last row on sheet
For Each c In Source.Range("A1:K1000") ' 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
Last edited by a moderator: