Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell contents vs. Formula contents | Excel Discussion (Misc queries) | |||
Display actual contents of cell | Excel Discussion (Misc queries) | |||
GET.CELL | Excel Worksheet Functions | |||
Modify Row & Cell Contents based upon Cells Values | Excel Worksheet Functions | |||
parse cell and insert rows? | Excel Worksheet Functions |