Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default macro for inserting one row between different data

Hi,

I am using excel 2003, my file looks like below

order no invoice no amount
123 S1000 $10
234 S1000 $20
456 S1001 $30
123 S1001 $40

I want to use a macro to insert a blank row to separate different invoice
no, how to write it ?

Thanks
eva cheng
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default macro for inserting one row between different data

Hi,

I have assumed your invoice numbers are in column B

Sub Insert_Rows()
'insert a row at every name change in a column B
Dim X As Long
Set Sht = Sheets("Sheet1")
MyColumn = "B"
For X = Sht.Cells(Rows.Count, MyColumn).End(xlUp).Row To 3 Step -1
If Sht.Cells(X - 1, MyColumn) < Cells(X, MyColumn) Then Rows(X).Insert
Next X
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"eva cheng" wrote:

Hi,

I am using excel 2003, my file looks like below

order no invoice no amount
123 S1000 $10
234 S1000 $20
456 S1001 $30
123 S1001 $40

I want to use a macro to insert a blank row to separate different invoice
no, how to write it ?

Thanks
eva cheng

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 464
Default macro for inserting one row between different data

I suggest NOT inserting blank rows in you table and simply increase row
heights instead.



--
Regards
Dave Hawley
www.ozgrid.com
"eva cheng" wrote in message
...
Hi,

I am using excel 2003, my file looks like below

order no invoice no amount
123 S1000 $10
234 S1000 $20
456 S1001 $30
123 S1001 $40

I want to use a macro to insert a blank row to separate different invoice
no, how to write it ?

Thanks
eva cheng


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
Inserting function into worksheet via macro John mac Excel Discussion (Misc queries) 4 December 14th 09 10:47 PM
Macro Inserting a formula Kristi Excel Discussion (Misc queries) 0 May 13th 09 05:29 PM
Macro Help- Inserting Blank Rows jack Excel Discussion (Misc queries) 3 January 16th 07 09:43 PM
Pivot Table Macro not inserting all data fields [email protected] Excel Discussion (Misc queries) 0 October 27th 06 04:55 AM
inserting row macro daroc Excel Discussion (Misc queries) 2 March 7th 06 06:27 PM


All times are GMT +1. The time now is 11:27 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"