Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Adding strings using macros
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. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Adding strings using macros
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. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Adding strings using macros
sub AddX()
for i=1 to cells(rows.count,"a").end(xlup).row cells(i,"a").value=cells(i,"a")&"-"& i next i end sub -- Don Guillett Microsoft MVP Excel SalesAid Software "ultrarev" wrote in message ... 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. |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Adding strings using macros
If you prefer formula, in column B
=A1&"-"&ROW(A1) -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "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. |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Adding strings using macros
Thank you sooooooo much!!!!!!
"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. |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
adding column to workbook with macros | Excel Discussion (Misc queries) | |||
Adding macros to toolbars | Excel Discussion (Misc queries) | |||
How to find number of pairs of strings from list of strings? | Excel Worksheet Functions | |||
ex.=($B$4+C4) in macros for row why adding rest | Excel Worksheet Functions | |||
ex.=($B$4+C4) in macros for row why adding rest | Excel Worksheet Functions |