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: 16
Default Subscript out of range....

Hi

I am trying to run the below code to import the contents of a sheet from an
external wb to the current workbook but it is coming up with the error
'Subscript out of range' on line
Workbooks(CurWkBk).Worksheets("ZPODetails").Range( "a1").Paste
Can anyone help me fix this and also give me a reason why this error fires?

TIA

Sub Import_ZPODetails()
Dim FName As String
Dim WkBk As Workbook
Dim CurWkBk As String

CurWkBk = ActiveWorkbook.Name

FName = Application.GetOpenFilename()
If FName < "False" Then
Set WkBk = Workbooks.Open(FName)
WkBk.Worksheets(1).Cells.Copy
Workbooks(CurWkBk).Worksheets("ZPODetails").Range( "a1").Paste
WkBk.Close SaveChanges:=False

End If

End Sub

 
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
9: Subscript out of range jenz21985 Excel Discussion (Misc queries) 6 May 5th 06 03:36 PM
Subscript out of Range teresa Excel Programming 4 December 19th 04 07:11 PM
Subscript is out of Range teresa Excel Programming 2 December 19th 04 05:00 PM
Subscript out of Range Q John Excel Programming 5 December 14th 04 07:54 AM
Subscript Out of Range Al Excel Programming 5 September 22nd 04 07:07 PM


All times are GMT +1. The time now is 05:52 PM.

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"