Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 505
Default Excel 2002: Can I do conditional editing ?

Hello,

I have the folowing table:


1 Code Date Amount
2 L21 XXX XXXXX
3 L21
4 U54 <--- insert a row above when the code
chanes
5 Y63
6 Y63
7 Y63
8
1499 B16
1500 P58

Is there a way for me to insert a row automatically above it code changes ?

Thanks

Low
--
A36B58K641
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Excel 2002: Can I do conditional editing ?

Hi,

I assume that's column A with the codes in. Right click your sheet tab, view
code and paste this in and run it.

Sub cutaneous()
Dim MyRange
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For x = lastrow To 2 Step -1
If Cells(x, 1).Value < Cells(x - 1, 1).Value Then
Rows(x).EntireRow.Insert
End If
Next
End Sub

Mike

"Mr. Low" wrote:

Hello,

I have the folowing table:


1 Code Date Amount
2 L21 XXX XXXXX
3 L21
4 U54 <--- insert a row above when the code
chanes
5 Y63
6 Y63
7 Y63
8
1499 B16
1500 P58

Is there a way for me to insert a row automatically above it code changes ?

Thanks

Low
--
A36B58K641

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Excel 2002: Can I do conditional editing ?

You may want to sort your data by the code and then use Data|Subtotals.

You'll get that extra line inserted along with totals/averages/counts (whatever
you choose).

Mr. Low wrote:

Hello,

I have the folowing table:


1 Code Date Amount
2 L21 XXX XXXXX
3 L21
4 U54 <--- insert a row above when the code
chanes
5 Y63
6 Y63
7 Y63
8
1499 B16
1500 P58

Is there a way for me to insert a row automatically above it code changes ?

Thanks

Low
--
A36B58K641


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 857
Default Excel 2002: Can I do conditional editing ?

Hi,

It is also possible to do this via a PivotTable, however I think Mike's code
or a modification of it would be better:

Sub cutaneous()
Dim x As Long
Application.ScreenUpdating = False
For x = [A65536].End(xlUp).Row To 2 Step -1
If Cells(x, 1) < Cells(x - 1, 1) Then
Rows(x).EntireRow.Insert
End If
Next x
End Sub

Cheers,
Shane
"Mr. Low" wrote in message
...
Hello,

I have the folowing table:


1 Code Date Amount
2 L21 XXX XXXXX
3 L21
4 U54 <--- insert a row above when the code
chanes
5 Y63
6 Y63
7 Y63
8
1499 B16
1500 P58

Is there a way for me to insert a row automatically above it code changes
?

Thanks

Low
--
A36B58K641


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
Excel 2002: Any quick way for editing VLOOKUP formulas ? Mr. Low Excel Discussion (Misc queries) 1 April 4th 08 04:50 PM
Excel 2002 Editing/Modifying a link Eggsell Excel Discussion (Misc queries) 1 August 20th 07 10:21 PM
Conditional Formatting (Excel 2002 SP3) vertigo Excel Worksheet Functions 5 April 20th 07 10:24 AM
Conditional formatting.... Excel 2002 Gunjani Excel Worksheet Functions 1 February 13th 06 10:58 AM
Filename is locked for editing in Excel 2002 SP3 Lloyd Excel Discussion (Misc queries) 1 December 6th 05 06:31 PM


All times are GMT +1. The time now is 11:15 AM.

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"