![]() |
insert blank row when cell changes
Hi,
I have sorted a long list of data. I now have some cells that are the same and then the data changes. What I want to do is insert a blank row everytime the cel value changes. For eg... ColumA John John Tony Andrea Andrea Andrea Ivano Tom So the macro would look at column A and everytime the name changes it will insert a blank row. Thanks, Ivano |
insert blank row when cell changes
This code needs to be inserted in the sheet. Right click the sheet tab and
select view code. Paste the following Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then _ Target.Offset(1, 0).EntireRow.Insert End Sub This code inserts a blank row immediately below the cell in column A that was changed. -- HTH... Jim Thomlinson "Ivano" wrote: Hi, I have sorted a long list of data. I now have some cells that are the same and then the data changes. What I want to do is insert a blank row everytime the cel value changes. For eg... ColumA John John Tony Andrea Andrea Andrea Ivano Tom So the macro would look at column A and everytime the name changes it will insert a blank row. Thanks, Ivano |
insert blank row when cell changes
Hi Jim,
I insterted it into the sheet. Now what. I tried the Run symbol but I get an error. I tried a few things but I couldn't get it to execute. What do I have to do to get it going? Thanks "Jim Thomlinson" wrote: This code needs to be inserted in the sheet. Right click the sheet tab and select view code. Paste the following Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then _ Target.Offset(1, 0).EntireRow.Insert End Sub This code inserts a blank row immediately below the cell in column A that was changed. -- HTH... Jim Thomlinson "Ivano" wrote: Hi, I have sorted a long list of data. I now have some cells that are the same and then the data changes. What I want to do is insert a blank row everytime the cel value changes. For eg... ColumA John John Tony Andrea Andrea Andrea Ivano Tom So the macro would look at column A and everytime the name changes it will insert a blank row. Thanks, Ivano |
insert blank row when cell changes
jim, tried that for the heck of it and it inserted 256 rows,
i put 3 names in a1:a3 in b1:b3 i entered 1,2,3 respectively when i changed the name in a2, it inserted 256 rows -- Gary "Jim Thomlinson" wrote in message ... This code needs to be inserted in the sheet. Right click the sheet tab and select view code. Paste the following Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then _ Target.Offset(1, 0).EntireRow.Insert End Sub This code inserts a blank row immediately below the cell in column A that was changed. -- HTH... Jim Thomlinson "Ivano" wrote: Hi, I have sorted a long list of data. I now have some cells that are the same and then the data changes. What I want to do is insert a blank row everytime the cel value changes. For eg... ColumA John John Tony Andrea Andrea Andrea Ivano Tom So the macro would look at column A and everytime the name changes it will insert a blank row. Thanks, Ivano |
All times are GMT +1. The time now is 06:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com