Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Inseart row if cell number is repeating

Hi

I have a data sheet, which is a sales data which contains item
particulars. each invoice contains one or more items. many of them is
single item which ends in single row. if more items are there, it
comes in different rows. i want to inseart one row each if the invoice
number is repeating to two three up to 20 rows. new row need to come
top of the cell number

1 rice 10 kg
27.00 270.00
2 oil 3 kl
80-00 240.00
3 Rice 5 kg
33.00 165.00
3 oil 1 kl
80.00 80.00
4 Salt 1 kg
10.00 10.00


the invoce number (cell number) "first column" 3 is repeating twice.

1 rice 10 kg
27.00 270.00
2 oil 3 kl
80-00 240.00

3 Rice 5 kg
33.00 165.00
3 oil 1 kl
80.00 80.00
4 Salt 1 kg
10.00 10.00


i insearted one row after cell number 2, anyonce can help to creat
one macro for this?(Inseart row with condition)


thanks

Jophy




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default Inseart row if cell number is repeating

Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long

Application.ScreenUpdating = False

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow - 2 To 2 Step -1

If .Cells(i, "A").Value < .Cells(i + 1, "A").Value And _
.Cells(i + 1, "A").Value = .Cells(i + 2, "A").Value Then

.Rows(i + 1).Insert
End If
Next i
End With

Application.ScreenUpdating = True

End Sub


--
__________________________________
HTH

Bob

"JoeM" wrote in message
...
Hi

I have a data sheet, which is a sales data which contains item
particulars. each invoice contains one or more items. many of them is
single item which ends in single row. if more items are there, it
comes in different rows. i want to inseart one row each if the invoice
number is repeating to two three up to 20 rows. new row need to come
top of the cell number

1 rice 10 kg
27.00 270.00
2 oil 3 kl
80-00 240.00
3 Rice 5 kg
33.00 165.00
3 oil 1 kl
80.00 80.00
4 Salt 1 kg
10.00 10.00


the invoce number (cell number) "first column" 3 is repeating twice.

1 rice 10 kg
27.00 270.00
2 oil 3 kl
80-00 240.00

3 Rice 5 kg
33.00 165.00
3 oil 1 kl
80.00 80.00
4 Salt 1 kg
10.00 10.00


i insearted one row after cell number 2, anyonce can help to creat
one macro for this?(Inseart row with condition)


thanks

Jophy






  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Inseart row if cell number is repeating

Thanks bob its fantastic

god bless you


jophy
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
How do I keep from repeating a number in the same column? Stephanie Excel Discussion (Misc queries) 3 September 6th 07 10:48 PM
Repeating Number Sly Excel Worksheet Functions 1 July 28th 07 10:44 PM
random number without repeating? nonoi via OfficeKB.com Excel Worksheet Functions 2 July 11th 05 05:59 AM
how to stop repeating a number in worksheet(e.g. cell A1 is 6655 . Mushtaque Parker Excel Discussion (Misc queries) 0 April 24th 05 01:04 PM
Random Number Non Repeating ... a_ryan1972 Excel Discussion (Misc queries) 3 April 6th 05 09:26 PM


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