Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
concatenate values Flint springs Excel Worksheet Functions 4 May 23rd 09 08:41 PM
Concatenate Values with VBA jlclyde Excel Discussion (Misc queries) 2 October 1st 08 07:05 PM
Concatenate values IF() Nikki Excel Worksheet Functions 21 May 12th 07 11:06 PM
Concatenate values dan Excel Worksheet Functions 2 August 14th 06 11:03 PM
concatenate function/convert military to AM/PM brianwakin Excel Worksheet Functions 1 September 1st 05 07:40 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"