T
tehwa
Hello, and Merry Christmas
I have an output file in .xls format from a program, and need to impor
the data into a database. To do this I need to do some cleve
formatting to the worksheet via a macro.
I believe it to be possible, and have some rough pseudocode tha
describes the macros routine, however I have little to no knowledge o
the VB language and this makes things pretty difficult with a deadlin
that potentially erases my Christmas break.
I do not expect someone to relieve me of the task, but I require som
heavy assistance with the syntax to be used.
Firstly I need to select the first column's data:
<code>
Columns("A:A").Select
</code>
I suspect this to be correct syntax.
And find whether the first cell contains data.
If it does contains data, put that data into a variable:
<code>
If [cell].IsNotNull Then
[cell] = variable_referenceData
Then check the next cell in the column to see if it is null. If it i
null, insert the variable (the NotNull cell) into that cell, and d
this until it reaches a cell that is not empty. When it reaches a cel
in the column that is not empty, make this the ne
variable_referenceData:
if nextCell = null Then
[cell] = variable_referenceCell
Else nextCell = varaiable_referneceData;
Continue this until the end of the dataset (I am not sure if Excel wil
automatically do this, or whether I need to check when an empty cell i
reached, whether or not the whole row is null).
What I hope for this to do is to format a document that has th
following formatting (where ':' delimits cell seperations):
Name:detail
:detail
:detail
:detail
To a format of
Name:detail
Name:detail
Name:detail
Name:detial
The final piece of macro will save the file as a .csv file. I hope tha
someone can tell me if this is possible, and the syntax that will mak
it work.
Alternatively, if anyone has had this problem before (needing to impor
a csv file but has this formatting problem) I would dearly love to hea
of your solution. The program that produces the .xls file also export
as .csv, however it TABS the data without options to remove thi
formatting.
Thanks very much for your time, and Merry Christmas
.tehw
I have an output file in .xls format from a program, and need to impor
the data into a database. To do this I need to do some cleve
formatting to the worksheet via a macro.
I believe it to be possible, and have some rough pseudocode tha
describes the macros routine, however I have little to no knowledge o
the VB language and this makes things pretty difficult with a deadlin
that potentially erases my Christmas break.
I do not expect someone to relieve me of the task, but I require som
heavy assistance with the syntax to be used.
Firstly I need to select the first column's data:
<code>
Columns("A:A").Select
</code>
I suspect this to be correct syntax.
And find whether the first cell contains data.
If it does contains data, put that data into a variable:
<code>
If [cell].IsNotNull Then
[cell] = variable_referenceData
Then check the next cell in the column to see if it is null. If it i
null, insert the variable (the NotNull cell) into that cell, and d
this until it reaches a cell that is not empty. When it reaches a cel
in the column that is not empty, make this the ne
variable_referenceData:
if nextCell = null Then
[cell] = variable_referenceCell
Else nextCell = varaiable_referneceData;
Continue this until the end of the dataset (I am not sure if Excel wil
automatically do this, or whether I need to check when an empty cell i
reached, whether or not the whole row is null).
What I hope for this to do is to format a document that has th
following formatting (where ':' delimits cell seperations):
Name:detail
:detail
:detail
:detail
To a format of
Name:detail
Name:detail
Name:detail
Name:detial
The final piece of macro will save the file as a .csv file. I hope tha
someone can tell me if this is possible, and the syntax that will mak
it work.
Alternatively, if anyone has had this problem before (needing to impor
a csv file but has this formatting problem) I would dearly love to hea
of your solution. The program that produces the .xls file also export
as .csv, however it TABS the data without options to remove thi
formatting.
Thanks very much for your time, and Merry Christmas
.tehw