Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting at End of Excel data

Status
Not open for further replies.

JDows

MIS
May 6, 2002
4
US
I have a monthly data update that I would like to put in an Excel macro.

I need to take a set of rows (a specific amount) from one sheet and put them at the bottom of another worksheet (varible set of rows- added onto every month).

I have figured out how to insert at the top of this data set, but not at the bottom. Any help would be appreciated.

Thanks!
 
This will add text to the bottom of your spreadsheet. Just one warning, if you have a blank line in the middle of your data it will fool this script.


set x = getobject(,"excel.application")
r = 1

do until len(x.cells(r, 1).value) = 0
r = r + 1
Loop
x.cells(r, 1).value = "Text you want to add"
 
Say that xlApp is your instantation of the Excel.Application object.
Try something like this:
Const xlPrevious=2
Const xlByRows=1
LastRow=xlApp.ActiveSheet.Cells.Find("*",,,,xlByRows,xlPrevious).Row

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top