Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Export CSV; first three rows contain record map
Hello All
I have a situation where I have a worksheet with rows of data to export to a CSV file using VBA. Simple enough. Now for the kicker. The first three rows are record maps ending with a "+" and I need to parse them to Row1 = 10 records, Row2 = 5 records and Row3 = 10 records while the data in the remaining rows will contain 50 records. i.e. csv output now: Name,Date,,,,,,,,,+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,, GL,,,,,+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,, Location,State,,,,,,,,,+,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, desired csv output: Name,Date,,,,,,,,,+ GL,,,,,+ Location,State,,,,,,,,,+ data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, I am trying to avoid manual edit of csv file after export; dealing with a repetitive process with multiple files. Any suggestions? Thanks in advance DW |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Export CSV; first three rows contain record map
You can try adding code like this.
for each rw in Range(1:3).rows for each cell in rw.cells if cell.Value = "+" then Range(cell.offset(0,1),cells(cell.row,256)).ClearC ontents exit for end if Next Next ' no export the CSV -- Regards, Tom Ogilvy "DW" wrote in message om... Hello All I have a situation where I have a worksheet with rows of data to export to a CSV file using VBA. Simple enough. Now for the kicker. The first three rows are record maps ending with a "+" and I need to parse them to Row1 = 10 records, Row2 = 5 records and Row3 = 10 records while the data in the remaining rows will contain 50 records. i.e. csv output now: Name,Date,,,,,,,,,+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,, GL,,,,,+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,, Location,State,,,,,,,,,+,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, desired csv output: Name,Date,,,,,,,,,+ GL,,,,,+ Location,State,,,,,,,,,+ data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, data,data,data,data,data,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,, I am trying to avoid manual edit of csv file after export; dealing with a repetitive process with multiple files. Any suggestions? Thanks in advance DW |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Export Single Record to Append to Access Table | Excel Discussion (Misc queries) | |||
how to treat rows as one record | Excel Discussion (Misc queries) | |||
combining multiple rows into 1 record | Excel Worksheet Functions | |||
combine 2 rows into 1 record | Excel Discussion (Misc queries) | |||
Export Access Record to Specific Cells in Excel | Excel Discussion (Misc queries) |