trying to find a way to make duplicates and add identifiers to a

G

Guest

I am looking for some help…I am trying to find a way to make duplicates and
add identifiers to a list of numbers. I can generate the sequential numbers
no problem (easy I know) but I am having trouble finding a way to get the
list repeat each number say twice and add a “-1†to the first one and a “-2â€
to the second. For example:
I can get:
1111
1112
1113

But I can’t figure out how to get
1111 1111-1
1111 1111-2
1112 OR 1112-1
1112 1112-2
1113 1113-1
1113 1113-2

Can some one point me in the right direction?
 
J

Jim Cone

You don't mention "code" so I will go with a practical approach.
Create two identical lists of your numbers.
(following assumes lists start in B5 and D5)
In an adjoining column to the first list enter = B5 & "-1"
In an adjoining column to the second list enter = D5 & "-2"
Fill down.
Copy the new lists and paste values over them.
Stack one column on top of the other, sort.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Mike" <[email protected]>
wrote in message
I am looking for some help…I am trying to find a way to make duplicates and
add identifiers to a list of numbers. I can generate the sequential numbers
no problem (easy I know) but I am having trouble finding a way to get the
list repeat each number say twice and add a “-1†to the first one and a “-2â€
to the second. For example:
I can get:
1111
1112
1113

But I can’t figure out how to get
1111 1111-1
1111 1111-2
1112 OR 1112-1
1112 1112-2
1113 1113-1
1113 1113-2

Can some one point me in the right direction?
 
G

Guest

Thanks for the advice…I am actually trying to write some code in a macro to
make this happen…if you can help that would be great!
I know how to manually combine lists like you mentioned and I could write a
macro using these steps in the macro I have running now but I am sure there
is a more streamlined way.

So far the macro I have will make a list based on what the user enters for
values…I am just not sure how to get it to repeat starting at the first empty
cell and then get it to add the -1 or -2

a = InputBox("What number do you want the labels start on?", "Starting
Number")
b = InputBox("How many labels do you need?", "Number of Labels")
c = InputBox(“How many replicates?â€, “Number of each IDâ€)

a1 = a
For i = 1 To b
Worksheets("button to make labels").Range("A2").Offset(i - 1, 0).Value = a1
a1 = a1 + 1
Next

thanks
Mike
 
J

Jim Cone

Sub GetYourTicket()
Dim a
Dim b
Dim c
Dim i
Dim n

a = InputBox("What number do you want the labels to start with?", "Starting Number ")
b = InputBox("How many labels do you need?", "Number of Labels")
c = InputBox("How many replicates?", "Number of each ID")

For i = 0 To (b - 1) Step c
For n = 1 To c
Cells(i + n, 1).Value = a & "-" & n
Next
a = a + 1
Next
End Sub
------------
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"Mike" <[email protected]>
wrote in message
Thanks for the advice…I am actually trying to write some code in a macro to
make this happen…if you can help that would be great!
I know how to manually combine lists like you mentioned and I could write a
macro using these steps in the macro I have running now but I am sure there
is a more streamlined way.
So far the macro I have will make a list based on what the user enters for
values…I am just not sure how to get it to repeat starting at the first empty
cell and then get it to add the -1 or -2

a = InputBox("What number do you want the labels start on?", "Starting
Number")
b = InputBox("How many labels do you need?", "Number of Labels")
c = InputBox(“How many replicates?â€, “Number of each IDâ€)

a1 = a
For i = 1 To b
Worksheets("button to make labels").Range("A2").Offset(i - 1, 0).Value = a1
a1 = a1 + 1
Next

thanks
Mike
 
G

Guest

Great!

Thanks for the help!

Jim Cone said:
Sub GetYourTicket()
Dim a
Dim b
Dim c
Dim i
Dim n

a = InputBox("What number do you want the labels to start with?", "Starting Number ")
b = InputBox("How many labels do you need?", "Number of Labels")
c = InputBox("How many replicates?", "Number of each ID")

For i = 0 To (b - 1) Step c
For n = 1 To c
Cells(i + n, 1).Value = a & "-" & n
Next
a = a + 1
Next
End Sub
------------
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"Mike" <[email protected]>
wrote in message
Thanks for the advice…I am actually trying to write some code in a macro to
make this happen…if you can help that would be great!
I know how to manually combine lists like you mentioned and I could write a
macro using these steps in the macro I have running now but I am sure there
is a more streamlined way.
So far the macro I have will make a list based on what the user enters for
values…I am just not sure how to get it to repeat starting at the first empty
cell and then get it to add the -1 or -2

a = InputBox("What number do you want the labels start on?", "Starting
Number")
b = InputBox("How many labels do you need?", "Number of Labels")
c = InputBox(“How many replicates?â€, “Number of each IDâ€)

a1 = a
For i = 1 To b
Worksheets("button to make labels").Range("A2").Offset(i - 1, 0).Value = a1
a1 = a1 + 1
Next

thanks
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top