Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 19
Default make it 12 rows from 1 row

hi,
i have 1000 rows and each row i need to divide by 12 so that it will become
12 rows.

for example :
from this :
class qty
10 1200
20 1000
....
....
...

to this:
no class qty
1 10 100
2 10 100
3 10 100
4 10 100
5 10 100
6 10 100
7 10 100
8 10 100
9 10 100
10 10 100
11 10 100
12 10 100


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 367
Default make it 12 rows from 1 row

you can use this function.

i hope i understood correctly what you meant:
'------------------------------------------------------------------------------------
Sub Rows12()

Dim class_ As Variant
Dim qty_ As Double

For i = 2 To 65536
If Cells(i, 1) = "" Then Exit Sub

class_ = Cells(i, 1).Value
qty_ = Round(Cells(i, 2).Value / 12, 2)

Cells(i, 1).Value = class_
Cells(i, 2).Value = qty_

For j = 1 To 11
Rows(i + 1).Insert (xlDown)

Cells(i + 1, 1).Value = class_
Cells(i + 1, 2).Value = qty_
Next j

i = i + 11

Next i

End Sub
'------------------------------------------------------------------------------------

as you see with the for loop i start with 2, if you have titles,
you can leave it like that, if not start with 1.

i rounded the result of the quantity to 2 places after the comma,
you can adjust it like you want, maybe it's best if you don't round
it, and just edit the format of the cells, that way you can continue
calculating with them.

hth

Carlo


On Nov 26, 4:48 pm, AskExcel
wrote:
hi,
i have 1000 rows and each row i need to divide by 12 so that it will become
12 rows.

for example :
from this :
class qty
10 1200
20 1000
...
...
..

to this:
no class qty
1 10 100
2 10 100
3 10 100
4 10 100
5 10 100
6 10 100
7 10 100
8 10 100
9 10 100
10 10 100
11 10 100
12 10 100


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 CAN I TAKE 2 ROWS AND MAKE THEM EQUAL A PRICE Ron Excel Discussion (Misc queries) 3 April 9th 06 01:37 PM
how do I make the first three rows repeat on top of every page? StardustDave New Users to Excel 2 January 29th 06 10:51 PM
Make a Macro take out rows and add it to new worksheet Vic Excel Discussion (Misc queries) 9 December 2nd 05 03:25 PM
make colour in rows stay Crowraine Excel Discussion (Misc queries) 1 January 28th 05 03:14 PM
How do I make bi-Lingual on a colum in many rows? logengr Excel Discussion (Misc queries) 0 January 22nd 05 10:59 AM


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