Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting 2 rows above a certain cell
I have a column with numbers that are sorted in ascending order e.g
1 1 1 3 3 3 7 7 7 The highest number possible is 8. I would like to insert a line above the spot where the number changes. How can I do this? -- Thanks very much. KDJ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting 2 rows above a certain cell
In this case, one between last 3 and first 7? Or, 3-7 and 1-3?
-- Don Guillett Microsoft MVP Excel SalesAid Software "KDJ" wrote in message ... I have a column with numbers that are sorted in ascending order e.g 1 1 1 3 3 3 7 7 7 The highest number possible is 8. I would like to insert a line above the spot where the number changes. How can I do this? -- Thanks very much. KDJ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting 2 rows above a certain cell
Subject is at odds with the text!
Public Sub ProcessData() Const TEST_COLUMN As String = "A" '<=== change to suit Dim i As Long Dim iLastRow As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = iLastRow - 1 To 1 Step -1 If .Cells(i, TEST_COLUMN).Value < .Cells(i + 1, TEST_COLUMN).Value Then .Rows(i + 1).Insert End If Next i End With End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "KDJ" wrote in message ... I have a column with numbers that are sorted in ascending order e.g 1 1 1 3 3 3 7 7 7 The highest number possible is 8. I would like to insert a line above the spot where the number changes. How can I do this? -- Thanks very much. KDJ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting 2 rows above a certain cell
I realised the mistake after I posted. Sorry!! Momentary lapse of reason ...
Yes, I did mean insert 2 rows (lines) above the spot where the number changes i.e. above the first time 3 appears and above the first time 7 appears. Thank you! KDJ "Bob Phillips" wrote: Subject is at odds with the text! Public Sub ProcessData() Const TEST_COLUMN As String = "A" '<=== change to suit Dim i As Long Dim iLastRow As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = iLastRow - 1 To 1 Step -1 If .Cells(i, TEST_COLUMN).Value < .Cells(i + 1, TEST_COLUMN).Value Then .Rows(i + 1).Insert End If Next i End With End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "KDJ" wrote in message ... I have a column with numbers that are sorted in ascending order e.g 1 1 1 3 3 3 7 7 7 The highest number possible is 8. I would like to insert a line above the spot where the number changes. How can I do this? -- Thanks very much. KDJ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting 2 rows above a certain cell
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit Dim i As Long Dim iLastRow As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = iLastRow - 1 To 1 Step -1 If .Cells(i, TEST_COLUMN).Value < .Cells(i + 1, _ TEST_COLUMN).Value Then .Rows(i + 1).Resize(2).Insert End If Next i End With End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "KDJ" wrote in message ... I realised the mistake after I posted. Sorry!! Momentary lapse of reason ... Yes, I did mean insert 2 rows (lines) above the spot where the number changes i.e. above the first time 3 appears and above the first time 7 appears. Thank you! KDJ "Bob Phillips" wrote: Subject is at odds with the text! Public Sub ProcessData() Const TEST_COLUMN As String = "A" '<=== change to suit Dim i As Long Dim iLastRow As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = iLastRow - 1 To 1 Step -1 If .Cells(i, TEST_COLUMN).Value < .Cells(i + 1, TEST_COLUMN).Value Then .Rows(i + 1).Insert End If Next i End With End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "KDJ" wrote in message ... I have a column with numbers that are sorted in ascending order e.g 1 1 1 3 3 3 7 7 7 The highest number possible is 8. I would like to insert a line above the spot where the number changes. How can I do this? -- Thanks very much. KDJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting rows while keeping cell contents the same | Excel Discussion (Misc queries) | |||
anchor comments to cell while inserting and deleting rows | Excel Discussion (Misc queries) | |||
Inserting rows on cell trigger | Excel Programming | |||
Using absolute cell refernce and inserting rows | Excel Worksheet Functions | |||
Cell References When Inserting Rows | Excel Discussion (Misc queries) |