Copy titles from another workbook

  • Thread starter Thread starter Indu Aronson
  • Start date Start date
I

Indu Aronson

There are several worksheets that I use that have the same
titles. I have created a file at C:\ILA\GuestTitles.xls
that have the titles I want in Sheet1 of that workbook.

How can I copy the titles in GuestTitles.xls to any
current worksheet.

I have this much:
Workbooks.open Filename:="C:\ILA\GuestTitles.xls"

I can't predict the name of the activeworksheet (the
target sheet) and thus am not sure how to copy the titles
over.

GuestTitles has titles from A1:L2.

I hope I have been clear enough for a response.

Thank you.
 
Thanks Anders and Gord for your help.

(Gord, I couldn't use a template because I already had
data in various sheets and changed my mind about the
titles!)

-----Original Message-----
Hi Indu,

Here's one try:

----

Option Explicit

Sub copyTitles()
Dim destSheet As Worksheet
Dim srcBookName As String, srcBook As Workbook
Set destSheet = ActiveSheet
srcBookName = "C:\ILA\GuestTitles.xls"
Workbooks.Open Filename:=srcBookName
Set srcBook = ActiveWorkbook
ActiveSheet.Rows(1).Copy Destination:=destSheet.Rows (1)
srcBook.Close
End Sub

----

HTH
Anders Silven

"Indu Aronson" <[email protected]>
skrev i meddelandet [email protected]...
 

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