Appending...?

  • Thread starter Thread starter garry
  • Start date Start date
G

garry

Is it possible to automatically "append" new data to an existin
spreadsheet? Here's the deal: I have an application that posts dat
to a spreadsheet. Currently, the software opens the spreadsheet an
finds the next row with no data (next available row), and then I trac
that number throughout the program, incrementing by "1" for each ne
data entry to come. This works, but it's sloppy...and risky. Seem
like there should be a smoother way than what I'm doing: Opening an
reading the file until I see no data, and using that last row# as th
next Start Row #. Problem is...this works okay as long as th
application is running; appends to THAT DAY's spreadsheet. But I wan
to create a MASTER spreadsheet that just keeps appending fro
day-to-day, without having to find (and manage) the Start Row numbe
for each entry.

Thanks for any help you may be able to offer.
Garry
([email protected]
 
Hi Garry,

Using column A for determination purposes, the next available row number
will be given by:

Cells(Rows.Count, "A").End(xlUp)(2).Row
 
Is it possible to automatically "append" new data to an existing
spreadsheet?

I'm not exactly sure how you have things set up. Would you be able to use
Excel 2003's new ListObject? Here, I assume you have data in Columns A:C,
with a heading row in Row 1. I also assume your data is surrounded by
blank cells. Here, I added, and deleted the ListObject, but you can
experiment.

Sub Demo()
'// Dana DeLouis
'// NewRange is where data gets inserted
Dim NewRange As ListRow
Range("A2").Select
With ActiveSheet
.ListObjects.Add(xlSrcRange, , , xlYes).Name = "MyList"

' You loop here to keep adding data...
Set NewRange = .ListObjects("MyList").ListRows.Add
NewRange.Range = Array("Billy", "Sales", 123.45)
' end of loop

.ListObjects("MyList").Unlist
End With
End Sub
 
Back
Top