View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ultrarev ultrarev is offline
external usenet poster
 
Posts: 3
Default Adding strings using macros

Is it possible to insert new rows, example:

21-416B,C,P,R

and have it look like this:

21-416B
21-416C
21-416P
21-416R

I would greatly appreaciate any help!!

"Mike H" wrote:

Hi,

I've assumed this data are in column A. Right click your sheet tab, view
code and paste this in and run it.

Sub merge()
x = 1
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & lastrow)
For Each c In MyRange
c.Value = c.Value & "-" & x
x = x + 1
Next
End Sub

Mike

"ultrarev" wrote:

010630412
010630412
010630412
010630412
010630412
010630412
010630512
010630512
010630512
010630512
010630512

That is my line how can I make it look like this :

010630412-1
010630412-2
010630412-3
010630412-4
010630412-5
010630412-6
010630512-7
010630512-8
010630512-9

basically adding dash 1,2,3 and so fourth to every line without changing the
first set of numbers? Is this possible please explain.