Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert blank row after change in cell value not working. Wackyracer Excel Discussion (Misc queries) 1 February 2nd 10 01:11 PM
How to insert a slash into a blank cell Claudia New Users to Excel 1 August 13th 09 02:41 PM
Auto insert a blank row above the current row based on a cell val. mattwill Excel Discussion (Misc queries) 2 November 6th 08 11:30 PM
insert info only if cell is blank (Max from Singapore ref) Kevin Excel Discussion (Misc queries) 1 December 18th 07 05:31 PM
if cell is blank insert a zero JK Excel Discussion (Misc queries) 3 October 24th 07 03:09 PM


All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"