Solved Excel data management

Microsoft Excel for mac 2011 - macintosh
July 25, 2011 at 18:27:47
Specs: Macintosh
Need to consolidate an excel list such that if in Row a, column x is yes and column y is 0, take this row and move to another sheet

See More: Excel data management

Report •

#1
July 25, 2011 at 19:51:48
What do you mean by "Row a"?

Rows have numbers, Columns have letters.

Do you mean that any Row where Column X is "Yes" and Column Y is 0 should be moved?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
July 25, 2011 at 20:30:02
Yes sorry. Row #, not letter.

Report •

#3
July 25, 2011 at 21:16:33
✔ Best Answer
Try this code in a backup copy of your workbook since macros can not be easily undone:

Option Explicit
Sub MoveMyRows()
Dim lstRw, srcRw, dstRw As Integer
 lstRw = Sheets(1).Range("X" & Rows.Count).End(xlUp).Row
  For srcRw = lstRw To 1 Step -1
   If Sheets(1).Cells(srcRw, "X") = "Yes" And _
      Sheets(1).Cells(srcRw, "Y") = 0 Then
       dstRw = Sheets(2).Range("X" & Rows.Count).End(xlUp).Row + 1
        Sheets(1).Rows(srcRw).EntireRow.Copy _
          Destination:=Sheets(2).Cells(dstRw, "A")
        Sheets(1).Rows(srcRw).EntireRow.Delete
   End If
  Next
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •
Related Solutions


Ask Question