Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a problem. How to insert a row below a cell that contains a
given sign? For example, I need to insert a new row below every cell that contains x? X is in in every row in column A. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assumes your data starts at row 1.
Change the limits of r to suit your requirement. Note that, as the code adds a blank line after each X, this row range will have to be at least double the original row range. Note that X is case specific. Sub test() ' Lower value for r should be first data row + 1 ' Upper value = lower value + number of original rows For r = 2 To 20 ' X is case specific If Cells(r - 1, 1).Value = "X" Then Cells(r, 1).EntireRow.Insert End If Next End Sub Ian wrote in message ... I have a problem. How to insert a row below a cell that contains a given sign? For example, I need to insert a new row below every cell that contains x? X is in in every row in column A. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub insetRows()
Set sh = Sheets("Sheet1") rw = sh.Cells(65500, 1).End(xlUp).Row For c = rw To 1 Step -1 If sh.Cells(c, 1) = "X" Then sh.Cells(c, 1).EntireRow.Insert Next End Sub " skrev: I have a problem. How to insert a row below a cell that contains a given sign? For example, I need to insert a new row below every cell that contains x? X is in in every row in column A. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To avoid errors if case sensitive:
Sub rwInsrt() lr = Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 2 Step -1 If LCase(Cells(i, 1)) = "x" Then Cells(i, 1).EntireRow.Insert End If Next End Sub " wrote: I have a problem. How to insert a row below a cell that contains a given sign? For example, I need to insert a new row below every cell that contains x? X is in in every row in column A. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think he meant:
Cells(i + 1, 1).EntireRow.Insert -- Dan On Jan 3, 7:46*am, wrote: I have a problem. How to insert a row below a cell that contains a given sign? For example, I need to insert a new row below every cell that contains x? X is in in every row in column A. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|