Hi all,
I need to add code to loop through the code below, but I'm not exactly sure how to do this. Any help would be greatly appreciated.
What this is currently doing (In excel) is filtering on column "H" to find the criteria "No Match". Once found a new row is added to my table in within columns A to E. Then Un-filter column "H". Then repeat filter on column "H" to find the next "No Match" criteria and insert a new row in the table. The filtering and un-filtering needs to be done each time in order to recalculate the formulas in column H below the new added table row.
Can this code be looped until there are no more occurrences of "No Match" in column "H".
The recorded code below does this procedure 3 times but I would like to loop the code until there are no more occurrences of "No Match" in column "H".
Sub Insert_Rows()
'
' Insert_Rows Macro
'
'
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1, Criteria1:= _
"No Match"
Range("A329:E329").Select
Selection.ListObject.ListRows.Add (328)
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1, Criteria1:= _
"No Match"
Range("A331:E331").Select
Selection.ListObject.ListRows.Add (330)
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1, Criteria1:= _
"No Match"
Range("A339:E339").Select
Selection.ListObject.ListRows.Add (338)
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1
End Sub
Many thanks in advance.
Barry.
I need to add code to loop through the code below, but I'm not exactly sure how to do this. Any help would be greatly appreciated.
What this is currently doing (In excel) is filtering on column "H" to find the criteria "No Match". Once found a new row is added to my table in within columns A to E. Then Un-filter column "H". Then repeat filter on column "H" to find the next "No Match" criteria and insert a new row in the table. The filtering and un-filtering needs to be done each time in order to recalculate the formulas in column H below the new added table row.
Can this code be looped until there are no more occurrences of "No Match" in column "H".
The recorded code below does this procedure 3 times but I would like to loop the code until there are no more occurrences of "No Match" in column "H".
Sub Insert_Rows()
'
' Insert_Rows Macro
'
'
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1, Criteria1:= _
"No Match"
Range("A329:E329").Select
Selection.ListObject.ListRows.Add (328)
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1, Criteria1:= _
"No Match"
Range("A331:E331").Select
Selection.ListObject.ListRows.Add (330)
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1, Criteria1:= _
"No Match"
Range("A339:E339").Select
Selection.ListObject.ListRows.Add (338)
ActiveSheet.Range("$H$1:$H$3324").AutoFilter Field:=1
End Sub
Many thanks in advance.
Barry.