Using VBA to move a range of data to a different sheet when complete (need the for dummies version)

Copper Contributor

I'm trying to setup a macro so that when a task is completed (indicated with X), it automatically gets moved to a separate tab and deleted from original location.  I was able to accomplish this but it moved the entire row.  I'm trying to move a range of data, not the entire row.  Thanks!  

25 Replies
I found the same code online and i'm changing it to fit my file.
I also only want to extract from certain columns "A","E", and "F". What would you change in this row:
myCell.EntireRow.Copy Worksheets("Sheet2").Range("A" & Rows.Count).End(3)(2)

@austin2134 

Do you want to copy them to columns A, E and F, or for example to columns A, B and C?

That was going to be my next question.
From the original sheet, I only want 3/8 columns(A, E, and F). Once I figure that out, I want to place them into certain cells such as A, B, and C onto the next sheet.

@austin2134 

If you have Microsoft 365 or Office 2021, you can use the Filter function to copy specific columns to another sheet.

Advanced Filter is another option.

If you still prefer a macro, here is an example.

Sub Copy_cells_to_another_sheet()
    Dim myCell As Range
    Dim w As Worksheet
    Dim s As Long
    Dim m As Long
    Dim t As Long
    Dim rng As Range
    ' Target sheet
    Set w = Worksheets("Sheet2")
    t = w.Range("A" & w.Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    ' We're going to copy data from rows in which column D contain "x"
    m = Range("D" & Rows.Count).End(xlUp).Row
    For s = 2 To m
        If Range("D" & s).Value = "x" Then
            t = t + 1
            ' Copy cells form columns A, E and F
            Set rng = Range("A" & s & ",E" & s & ",F" & s)
            rng.Copy Destination:=w.Range("A" & t)
        End If
    Next s
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub

hi team

i need a code in which i can move my cells data to another sheet ,

like i have data in cells A to I

and if i write c in cell I1 then it should move data from cell A to I into another worksheet

thanks