Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
George
 
Posts: n/a
Default Insert new row as cell contents change

Insert new row as cell contents change. After importing
data I have a spread sheet with a column that contains a
series of alpha numeric characters. At various random
intervals in this column the contents change. EG rows 1 to
4 could contain ABC, then rows 5 to 15 could become 222. I
am looking for a method to insert a blank row
automatically between the rows were the contents change.
Many Thanks
Geo

  #2   Report Post  
Nick Hodge
 
Posts: n/a
Default

George

If you are familiar with VBA the code below will do what you want.
Preselect the column of data first

Sub InsertRowAfterValueChange()
Dim myCell As Range
Dim sCurrVal As String
sCurrVal = ActiveCell.Value
For Each myCell In Selection
If myCell.Value < sCurrVal Then
myCell.EntireRow.Insert
sCurrVal = myCell.Value
End If
Next myCell
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"George" wrote in message
...
Insert new row as cell contents change. After importing
data I have a spread sheet with a column that contains a
series of alpha numeric characters. At various random
intervals in this column the contents change. EG rows 1 to
4 could contain ABC, then rows 5 to 15 could become 222. I
am looking for a method to insert a blank row
automatically between the rows were the contents change.
Many Thanks
Geo



  #3   Report Post  
George
 
Posts: n/a
Default

Nick, Many thanks, it worked perfectly.
-----Original Message-----
George

If you are familiar with VBA the code below will do what

you want.
Preselect the column of data first

Sub InsertRowAfterValueChange()
Dim myCell As Range
Dim sCurrVal As String
sCurrVal = ActiveCell.Value
For Each myCell In Selection
If myCell.Value < sCurrVal Then
myCell.EntireRow.Insert
sCurrVal = myCell.Value
End If
Next myCell
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England



"George" wrote in

message
...
Insert new row as cell contents change. After importing
data I have a spread sheet with a column that contains a
series of alpha numeric characters. At various random
intervals in this column the contents change. EG rows 1

to
4 could contain ABC, then rows 5 to 15 could become

222. I
am looking for a method to insert a blank row
automatically between the rows were the contents change.
Many Thanks
Geo



.

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
Cell contents vs. Formula contents Sarah Excel Discussion (Misc queries) 3 December 15th 04 06:02 PM
Display actual contents of cell xmasbob Excel Discussion (Misc queries) 1 December 6th 04 05:09 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 0 November 7th 04 03:31 PM
parse cell and insert rows? Gorrila Grod Excel Worksheet Functions 3 November 5th 04 08:19 AM


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

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

About Us

"It's about Microsoft Excel"