Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default annoying subscript out of range error

there's somehting wrong with the syntax of the following but i cant work out
what:

With Workbooks("G:\MI Report\Source Tables-DIR-Producers\Source Table -
Merge Template - Direct.xls")

.MergeWorkbook ("G:\MI Report\Source Tables-DIR-Producers\Source
Table-DIR-Producer JL.AP.xls")
.MergeWorkbook ("G:\MI Report\Source Tables-DIR-Producers\Source
Table-DIR-Producer SK.CG.xls")
.MergeWorkbook ("G:\MI Report\Source Tables-DIR-Producers\Source
Table-DIR-Producer ZB.KP.xls")

For Each sh In .Worksheets

sh.Visible = True
sh.Columns.EntireColumn.Hidden = False

Next sh

End With

error seems to be due to the full path ref.

i've tried taking out .xls but this makes no difference

please help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default annoying subscript out of range error

The with workbooks statement shouldn't have the Folder name, just the
basename of the file. Try this code.

Folder = "G:\MI Report\Source Tables-DIR-Producers\"
With Workbooks("Source Table - Merge Template - Direct.xls")

.MergeWorkbook (Folder & "Source Table-DIR-Producer JL.AP.xls")
.MergeWorkbook (Folder & "Source Table-DIR-Producer SK.CG.xls")
.MergeWorkbook (Folder & "Source Table-DIR-Producer ZB.KP.xls")

For Each sh In .Worksheets

sh.Visible = True
sh.Columns.EntireColumn.Hidden = False

Next sh

End With


"PBcorn" wrote:

there's somehting wrong with the syntax of the following but i cant work out
what:

With Workbooks("G:\MI Report\Source Tables-DIR-Producers\Source Table -
Merge Template - Direct.xls")

.MergeWorkbook ("G:\MI Report\Source Tables-DIR-Producers\Source
Table-DIR-Producer JL.AP.xls")
.MergeWorkbook ("G:\MI Report\Source Tables-DIR-Producers\Source
Table-DIR-Producer SK.CG.xls")
.MergeWorkbook ("G:\MI Report\Source Tables-DIR-Producers\Source
Table-DIR-Producer ZB.KP.xls")

For Each sh In .Worksheets

sh.Visible = True
sh.Columns.EntireColumn.Hidden = False

Next sh

End With

error seems to be due to the full path ref.

i've tried taking out .xls but this makes no difference

please help

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
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Subscript out of range error - save copy error bg18461[_16_] Excel Programming 2 June 13th 06 04:53 PM
Subscript out of range error - save copy error bg18461[_15_] Excel Programming 1 June 13th 06 04:36 PM
Annoying Problem - Subscript out of range witek Excel Programming 8 June 1st 06 08:36 PM
Type Mismatch error & subscript out of range error Jeff Wright[_2_] Excel Programming 3 May 14th 05 07:14 PM


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

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"