I didnt expect the code to be this easy, though it took some time to work it out -
Option Explicit
Sub final_data()
Dim lrow As Long, i As Long, j As Long, lastrow As Long, x As Long, counter As Long
With Worksheets("RawData")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
For j = 10 To 14
If .Cells(i, j).Value = "N" Then
.Range("A" & i & ":I" & i).Copy Worksheets("FinalData").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
lastrow = Worksheets("FinalData").Range("A" & Rows.Count).End(xlUp).Row
Worksheets("FinalData").Cells(lastrow, j).Value = "N"
End If
Next j
Next i
Worksheets("FinalData").Columns("J:N").HorizontalAlignment = xlCenter
End With
End Sub
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
Bookmarks