Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert a row according a condition
Hello everybody,
I need to insert a blank row above each row that has "PARAM_TYPE" as data on a single row as shown below: NAME = ""_AppsCollect"", PARAM_TYPE = COLLECTOR NAME = ""APPServerStatus"", PARAM_TYPE = CONSUMER NAME = ""BORDER"", ... NAME = ""LogIncreaseRate"", PARAM_TYPE = STANDARD and I found the following macro that does something similar, but this search for the word "Total" in column 1 and inserts a blank row after the match of "Total. ' insert a row after each row which contains "Total" in column 1 Dim rCell As Range For Each rCell In ActiveSheet.UsedRange.Columns(1).Cells If rCell.Value = "Total" Then rCell.Offset (1).EntireRow.Insert Next rCell Does anyone can tell me what do I need to modify in order to do what I mentioned at the beginning. Regards. Raul Rodriguez. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert a row according a condition
Sub InsertRows()
Dim rng as Range set rng = cells(rows.count,1).End(xlup) for i = rng.row to 1 step -1 if Application.Countif(cells(i,1).EntireRow,"*PARAM_T YPE*") 0 then cells(i,1).EntireRow.Insert end if Next End Sub -- Regards, Tom Ogilvy "Raul Rodriguez" wrote in message ... Hello everybody, I need to insert a blank row above each row that has "PARAM_TYPE" as data on a single row as shown below: NAME = ""_AppsCollect"", PARAM_TYPE = COLLECTOR NAME = ""APPServerStatus"", PARAM_TYPE = CONSUMER NAME = ""BORDER"", ... NAME = ""LogIncreaseRate"", PARAM_TYPE = STANDARD and I found the following macro that does something similar, but this search for the word "Total" in column 1 and inserts a blank row after the match of "Total. ' insert a row after each row which contains "Total" in column 1 Dim rCell As Range For Each rCell In ActiveSheet.UsedRange.Columns(1).Cells If rCell.Value = "Total" Then rCell.Offset (1).EntireRow.Insert Next rCell Does anyone can tell me what do I need to modify in order to do what I mentioned at the beginning. Regards. Raul Rodriguez. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert a date that does not update if a condition is true | Excel Worksheet Functions | |||
Insert rows with condition using macro | Excel Discussion (Misc queries) | |||
lookup with multiple condition, but one condition to satisfy is en | Excel Worksheet Functions | |||
insert a line on condition | Excel Discussion (Misc queries) | |||
Insert row if condition met | Excel Discussion (Misc queries) |