concatenate values / convert to csv help

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

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,
 
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
 
Thank you very much Tom for the prompt reply. Your
solution is exectly does what I was asking for.

Thanks again,

Will
 

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

Back
Top