Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Copy titles from another workbook

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Copy titles from another workbook

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" skrev i meddelandet ...
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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Copy titles from another workbook

Indu

For NEW worksheets without the VBA and copying.......

Create a new workbook with one sheet.

On that sheet place your titles and any other formatting you wish.

FileSave AsFile Type Template(*.xlt)

Name it SHEET and save to your XLSTART folder.

Any new inserted worksheet will be based on SHEET.xlt with your titles
included.

Gord Dibben Excel MVP

On Sat, 3 Apr 2004 01:54:32 +0200, "Anders S"
wrote:

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" skrev i meddelandet ...
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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy titles from another workbook

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"

skrev i meddelandet news:14c2401c418f5$0e818580
...
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.

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change multiple Chart Titles in different sheets in the same Workbook asprivl Excel Worksheet Functions 2 November 24th 10 10:44 AM
Adding titles to formatted gridded workbook Kathy Excel Discussion (Misc queries) 2 January 12th 09 05:34 PM
Copy Titles in a long list of rows toolate88 Excel Discussion (Misc queries) 2 September 11th 07 01:55 AM
HOW DO I PRINT A LIST OF WORKSHEET TITLES FOR A SPECIFIC WORKBOOK beyondthevail Excel Discussion (Misc queries) 1 August 30th 06 04:58 PM
How do I loop through workbook and rename all chart titles? Backpaddler Excel Programming 1 January 23rd 04 11:04 PM


All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"