Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting columns in excel file to csv format


Please see picture attached of the excel file I have.I want to do th
following steps using a macro..

step1.) select data from column A, rows 6 to rows 4006
step2.) select data from column B, rows 6 to rows 4006
step3.) export it as an csv file, name of the file will be the tex
found in cell B-5.

step 4.) select data from column A, rows 6 to rows 4006
step 5.) select data from Column C, rows 6 to rows 4006
step 6.) export it as an csv file, name of the file will be the tex
found in cell C-5.

So the pairs of data will be
A-B; A-C;A-D............................;A-CN

Thank-you in advance for the macro..

excelguru

+-------------------------------------------------------------------
|Filename: new.jpg
|Download: http://www.excelforum.com/attachment.php?postid=2740
+-------------------------------------------------------------------

--
excelgur
-----------------------------------------------------------------------
excelguru's Profile: http://www.excelforum.com/member.php...nfo&userid=882
View this thread: http://www.excelforum.com/showthread.php?threadid=27363

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting columns in excel file to csv format


Just copy and paste the code below into a new module in your master
data workbook and run "ExportToCSV"


Sub ExportToCSV()

On Error Resume Next
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim RefPage As Object
Dim NewWB As Object

'setup reference page

Set RefPage = ThisWorkbook.Sheets(1)

' change this to the master data sheet we are copying from

'Adata stores the A column Data
'OtherData stores the B, C, D, .... , CN column data

Dim Adata As Object, OtherData As Object

'loops B to CN columns

For colcount = 2 To 92
Set NewWB = Workbooks.Add
Set Adata = RefPage.Range("a6:a4006")
Adata.Copy
NewWB.Sheets(1).Select
NewWB.Sheets(1).Cells(1, 1).Select: ActiveSheet.Paste
Set OtherData = RefPage.Range(RefPage.Cells(6, colcount)
RefPage.Cells(4006, colcount))
OtherData.Copy
NewWB.Sheets(1).Select
NewWB.Sheets(1).Cells(1, 2).Select: ActiveSheet.Paste
NewWB.SaveAs Filename:=RefPage.Cells(5, colcount).Value & ".csv"
_
FileFormat:=xlCSV, CreateBackup:=False
NewWB.Close
Next
Application.ScreenUpdating = True

End Su

--
crispb
-----------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088
View this thread: http://www.excelforum.com/showthread.php?threadid=27363

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
How do I save excel file in text format without columns? Tuuti Excel Discussion (Misc queries) 1 July 15th 08 06:40 PM
exporting a chart to gif format using COM (Excel v11 and .net) Katie Charts and Charting in Excel 2 December 31st 04 06:04 AM
Exporting to a txt file in a certain format. johnfli Excel Discussion (Misc queries) 5 December 28th 04 06:09 PM
Exporting Excel output to pdf/rtf/doc format Simon Lenn Excel Programming 1 December 8th 03 03:11 PM
Exporting to Excel, Then Formatting Columns/Cells Matt[_20_] Excel Programming 1 October 30th 03 12:36 AM


All times are GMT +1. The time now is 08:31 PM.

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"