I need to select all rows that have an "x" in column B. Then I need to paste those rows to a new sheet. I don't know much about VBA, so this is as far as I could get.
Sub Macro4()
'Define last row
Dim lastrow As Integer
lastrow = Range("C" & Rows.Count).End(xlUp).Row
'Run loop
For i = 1 To lastrow
If Sheets("Sheet1").Cells(i, 2).Value = "x" Then
Sheets("Sheet1").Cells(i, 2).EntireRow.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
End If
Next i
End Sub
I also tried this:
Sub Macro5()
Dim text As String
text = "x"
For Each cell In Sheets("Sheet1").Columns("B:B")
If ActiveCell = text Then
EntireRow.Copy
Sheets("Sheet2").Range("A1").Select
Selection.Paste
End If
Next cell
End Sub
Bookmarks