I want in Excel (2003) to take an imported data dump and format it into a report. Most of what I have done has involved recording a macro and then customizing the code where ne
I used this in one of my task, where as I had array of test data of 100 iteration, which I want to trim to first 10 iteration, so I used the "iteration# > 10" cells to delete entire row.
Sub trim_row()
' trim_row Macro
' to trim row which is greater than iteration#10
Dim RowToTest As Long
Dim temp As String
Dim temp1 As Integer
For RowToTest = Cells(Rows.Count, 6).End(xlUp).Row To 2 Step -1
With Cells(RowToTest, 6)
temp = .Value
If temp = "" Then
Else
temp1 = Trim(Replace(temp, "Iteration# :: ", ""))
If temp1 > 10 Then
Rows(RowToTest).EntireRow.Delete
End If
End If
End With
Next RowToTest
End Sub
I user replace & trip to extract number from the string, and introduced the if = "" condition to skip the empty rows. I had empty row separating to set of test data.