LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default selecting workbook

Hi.
A while back I recorded a macro to select a worksheet from one workbook, and
then place that into another workbook.

I'd like to take this to the next step where I choose the workbook.
I have the following code, and get a " subscript out of range" error.

Dim WkBkName As String
Dim WkBkName1 As String

'
Workbooks.Open Filename:= _
"C:\Documents and Settings\UserName\Application
Data\Microsoft\Templates\TR Claim Book.xlt" _
, Editable:=True

WkBkName = InputBox(Prompt:="enter workbook name of where to copy
worksheet", Title:="Copy worksheet to existing workbook")

WkBkName1 = "S:\Users Shared\UserName\DTR\Active Files\" & WkBkName & ".xlsx"



Sheets("Tab # ").Select
Workbooks(WkBkName1).Activate
Sheets("Tab # ").Copy After:=Workbooks(WkBkName1).Sheets(Sheets.Count)



When I click the debug button, and mouse over the line that's highlighted in
yellow

"Workbooks(WkBkName1).Activate"

it shows the name of my file in a small message box.
what am I missing?

Thank you.


 
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
Selecting Different Workbook halem2[_60_] Excel Programming 7 April 25th 06 05:50 PM
Selecting data from another workbook gti_jobert[_50_] Excel Programming 3 March 3rd 06 02:49 PM
Selecting data from 1 workbook to copy and paste to a 2nd workbook JackSpam Excel Programming 2 July 20th 05 02:33 AM
Selecting a worksheet in a workbook Lazer[_8_] Excel Programming 1 August 24th 04 08:52 PM
Selecting workbook Lazer[_6_] Excel Programming 3 August 24th 04 08:12 PM


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

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

About Us

"It's about Microsoft Excel"