asdaftasabrush

New Member
Joined
Feb 1, 2017
Messages
8
I am wanting to move select data to another existing sheet in my spreadsheet. Any that say "Yes" will need the first column data and the reason (last column) to be brought across to the other sheet. In this case the "Sad" and "Angry" data is not needed on the new sheet for the report.

Example is not data I will collect:
HappyYesHe is having a good day
SadMaybe
AngryNo
EcstaticYesGot a new job
BoredYeshates his job

<tbody>
</tbody>

If this could be a macro that would be perfect. Thanks!!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
select column with Yes information (not all column just the cells in the table

then try this

Code:
Sub move()
Dim rng As Range
Dim cell As Range
Dim iCount As Long
Dim myArray() as Variant


Set rng = Selection
ReDim myArray(1 To Application.WorksheetFunction.CountIf(rng, "Yes"), 1 To 2)


For Each cell In rng
    If cell.Value = "Yes" Then
        iCount = iCount + 1
        myArray(iCount, 1) = cell.Offset(0, -1).Value
        myArray(iCount, 2) = cell.Offset(0, 3).Value
    End If
Next cell


Sheets("Name of existing destination worksheet").Activate


'assuming that new destination begins in cell A1, if not adjust destination
Range(Cells(1, 1), Cells(UBound(myArray, 1), 2)) = myArray


End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top