Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate values / convert to csv help
Hi all,
I have a table with only one column which is serial#. Could you help me to create a macro that will concatenate "prd-" text with serial# value and save the results as csv file in designated location. I am just learning VBA. The range in serial# colum is not static, it could change every week. So the range like a1:a100 can not be assigned. Thanks a lot and hugs to all, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate values / convert to csv help
Dim sh as Worksheet
Dim rng as Range, rng1 as Range set sh = Activesheet set rng = sh.Range(sh.Cells(1,1),Sh.Cells(1,1).End(xldown)) workbooks.Add activesheet.Range("a1").Resize(rng.rows.count,1).V alue = _ rng.Value set rng1 = ActiveSheet.Range("A1").CurrentRegion for each cell in rng1 cell.Value = "prd-" & cell.Value Next activeWorkbook.SaveAs FileName:="C:\files\file1.csv", _ FileFormat:=xlCsv activeworkbook.Close SaveChanges:=False -- Regards, Tom Ogilvy "Will" wrote in message ... Hi all, I have a table with only one column which is serial#. Could you help me to create a macro that will concatenate "prd-" text with serial# value and save the results as csv file in designated location. I am just learning VBA. The range in serial# colum is not static, it could change every week. So the range like a1:a100 can not be assigned. Thanks a lot and hugs to all, |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate values / convert to csv help
Thank you very much Tom for the prompt reply. Your
solution is exectly does what I was asking for. Thanks again, Will -----Original Message----- Dim sh as Worksheet Dim rng as Range, rng1 as Range set sh = Activesheet set rng = sh.Range(sh.Cells(1,1),Sh.Cells(1,1).End (xldown)) workbooks.Add activesheet.Range("a1").Resize(rng.rows.count,1). Value = _ rng.Value set rng1 = ActiveSheet.Range("A1").CurrentRegion for each cell in rng1 cell.Value = "prd-" & cell.Value Next activeWorkbook.SaveAs FileName:="C:\files\file1.csv", _ FileFormat:=xlCsv activeworkbook.Close SaveChanges:=False -- Regards, Tom Ogilvy "Will" wrote in message ... Hi all, I have a table with only one column which is serial#. Could you help me to create a macro that will concatenate "prd-" text with serial# value and save the results as csv file in designated location. I am just learning VBA. The range in serial# colum is not static, it could change every week. So the range like a1:a100 can not be assigned. Thanks a lot and hugs to all, . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
concatenate values | Excel Worksheet Functions | |||
Concatenate Values with VBA | Excel Discussion (Misc queries) | |||
Concatenate values IF() | Excel Worksheet Functions | |||
Concatenate values | Excel Worksheet Functions | |||
concatenate function/convert military to AM/PM | Excel Worksheet Functions |