Maureen,
To add a single row to (the bottom of) a table, assuming it's been
declared as variable myTbl, you can use:
myTbl.Rows.Add
If you want to add several rows at a time, just loop that step.
To know how to fill the *columns* with data from your text file,
we'd need to know how that file is arranged. Are you saying the
text file has lines like this:
A, B, C, D
E, F, G, H
but you want the cells in your table (after row 1) to look like
this?
A E
B F
C G
D H
It's almost certainly doable, but you need to explain more what you
want. For starters, you'll probably need to do some file I/O, so
you could look at the help for the Open statement and the Input#
statement, for reading data from sequential access files. (This
kind of thing dates back to old, icky, NON-Visual Basic and is a
lot less pretty than VBA.)
In the most ultra-simple form, to read *one* item from a text file
("c:\test\myfile.txt") and put it in the first cell of the second
row of the table myTbl, you could use code like this:
Open "C:\m\myfile.txt" For Input As #1
Input #1, x
myTbl.Cell(2,1).Range.Text = x
Close #1
Hope this helps a little.
---------- WWW: http://www.speakeasy.org/~mtangard ----------------
----------- "Life is nothing if you aren't obsessed." --John Waters
-------------------------------------------------------------------
Quote:
> I have a table from which I have deleted all rows but the first. I would now
> like to add rows using data I read from a txt file. My table has 6 columns,
> and I will read data for each column from my input file. How can I do that?