create multiple rows in a cell according to quantity entered in specified row

niwaresm

New Member
Joined
Sep 6, 2012
Messages
5
I'm using a bar code scanner to enter information in a excel spreadsheet. In cell 2c I have a quantity of 19 so I need to be able to scan 19 tags and 19 serial numbers. My question is how do I get cell 2E (Tag_No) and 2F (Serial) to automatically split into 19 rows or any specified number of rows accoring to the quantity placed in column C?

Example:
Date<o:p></o:p>
<FORM id=Form1>
Qty<o:p></o:p>
</FORM>
Verified quantity <o:p></o:p>
Item Description<o:p></o:p>
Tag_No<o:p></o:p>
Serial<o:p></o:p>
Pallet<o:p></o:p>
HIPPO<o:p></o:p>
BFI<o:p></o:p>
Altra B<o:p></o:p>
Furniture Inventory<o:p></o:p>
Technology<o:p></o:p>
9/6/2012<o:p></o:p>
20<o:p></o:p>
<o:p>19</o:p>
tables cafeteria<o:p></o:p>
1000907896<o:p></o:p>
144053916505<o:p></o:p>
123456789<o:p></o:p>
2<o:p></o:p>
10<o:p></o:p>
<o:p></o:p>
8<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
8<o:p></o:p>
8<o:p></o:p>
monitors flat<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
8<o:p></o:p>
8<o:p></o:p>
CPU<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
15<o:p></o:p>
14<o:p></o:p>
laptop<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>

<TBODY>
</TBODY>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
niwaresm,

Welcome to the MrExcel forum.

What version of Excel are you using?

Can we have another screenshot of the results for the row that contains the 19 (manually formatted by you)?
 
Upvote 0
hello thank you for your reply, im using 2003 Here is another example. When I put in the verified quantity (ie. 19 on the first line) I need tag, serial, pallet etc to allow me to scan 19 differnt barcodes and populate in the cell

Date<o:p></o:p>

Qty<o:p></o:p>

Verified quantity<o:p></o:p>

Item Description<o:p></o:p>

Tag_No<o:p></o:p>

Serial<o:p></o:p>

Pallet<o:p></o:p>

HIPPO<o:p></o:p>

BFI<o:p></o:p>

Altra B<o:p></o:p>

Furniture Inventory<o:p></o:p>

Technology<o:p></o:p>

9/6/2012<o:p></o:p>

20<o:p></o:p>

19<o:p></o:p>
tables cafeteria<o:p></o:p>
1000907896 1000907897 1000907898 1000907899 1000907900 1000907901 1000907902 1000907903 1000907904 1000907905 1000907906 1000907907 1000907908 1000907909 1000907910 1000907911 1000907912 1000907913 1000907914<o:p></o:p>
144053916505
144053916506
144053916507
144053916518
144053916509
144053916302
144053916400
144053916501
144053916493
144053916300
144053916602
144053916580
144053916577
144053916565
144053916542
144053916530
144053916523
144053916519
144053916595<o:p></o:p>


123456789<o:p></o:p>

2<o:p></o:p>

9<o:p></o:p>
<o:p></o:p>

8<o:p></o:p>
<o:p></o:p>
<o:p></o:p>

8<o:p></o:p>

8<o:p></o:p>
monitors flat<o:p></o:p>
123456789 123654987 321654895 654123789 958623478 956412389 956247589 325841256 <o:p></o:p>
123456789 123654987 321654895 654123789 958623478 956412389 956247589 325841257<o:p></o:p>

123456987<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>

8<o:p></o:p>

8<o:p></o:p>
CPU<o:p></o:p>
745896541 956859652 452136589 125364589 745896523 652314589 325645872 321524589<o:p></o:p>
745896541 956859652 452136589 125364589 745896523 652314589 325645872 321524590<o:p></o:p>

564789561<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>

15<o:p></o:p>

14<o:p></o:p>
laptop<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>

<TBODY>
</TBODY>
 
Upvote 0
niwaresm,

I can understand the numbering sequence for the Tag_No's for the 19 numbers.

But, I can not understand where the sequencing is coming from for the Serial numbers.


Click on the Reply to Thread button, and just put the word BUMP in the post. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
A worksheet event would be appropriate but I decided to use a macro instead which you would run after entering the value of theVerified tag in column C. It would create the spaces you need in columns E,F and G

Code:
Sub Macro2()
    n = ActiveCell.Row
    k = Cells(n, "C").Value
    msg = Cells(n, "E").Value
    msg2 = Cells(n, "F").Value
    msg3 = Cells(n, "G").Value
    
    For I = 1 To k
        msg = msg & Chr(10)
        msg2 = msg2 & Chr(10)
        msg3 = msg3 & Chr(10)
    Next I
    
    Cells(n, "E").Value = msg
    Cells(n, "F").Value = msg2
    Cells(n, "G").Value = msg3
End Sub
 
Upvote 0
Thank you so much. Do I have to run this macro for each line? Is there a way for me to run it for the entire spreadsheet so as I add lines/ quantities in cell C the macro will automatically run in E F and G?
 
Upvote 0
Yes there is.

But have you run it to at least confirm that it does what you require??
 
Upvote 0
You could use the worksheet event like this:

Instead of placing the code in a module, place in the particular worksheet that the code is required to work on

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("C2:C1000")) Is Nothing Then
        n = ActiveCell.Row
        k = Cells(n, "C").Value
        msg = Cells(n, "E").Value
        msg2 = Cells(n, "F").Value
        msg3 = Cells(n, "G").Value
        
        For I = 1 To k
            msg = msg & Chr(10)
            msg2 = msg2 & Chr(10)
            msg3 = msg3 & Chr(10)
        Next I
        
        Cells(n, "E").Value = msg
        Cells(n, "F").Value = msg2
        Cells(n, "G").Value = msg3
                
    End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,728
Messages
6,132,358
Members
449,720
Latest member
NJOO7

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top