Inserting tables with macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I’m trying to use a macro to get a table from one spreadsheet and place it in
another, then directly underneath this I need to insert another table. I have
this macro in place but the tables will have a different amount of rowes each
time I need to perform the macro. What macro would I use to enable me to
insert the second table one line under where the first table finishes,
regardless of how long the table is? Any ideas?
 
hi
Sub Macro1()

Workbooks.Open Filename:="K:\Excel\XCEL\History.xls"
Range("A1", Range("A1").End(xlDown).Offset(0, 10)).Copy
'the last line select 10 rows right. change if needed.
Windows("Book1").Activate
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
' the last row select 1 row down
ActiveCell.PasteSpecial xlPasteAll
Windows("History.xls").Activate
ActiveWorkbook.Close
End Sub
change to suit your data.

regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top