PC Review


Reply
Thread Tools Rate Thread

annoying subscript out of range error

 
 
PBcorn
Guest
Posts: n/a
 
      12th Jun 2008
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      12th Jun 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR: subscript out of range sam Microsoft Excel Programming 6 9th Oct 2009 12:02 AM
Subscript out of range error kev_06 Microsoft Excel Programming 2 6th Jun 2006 11:18 PM
Re: Annoying Problem - Subscript out of range witek Microsoft Excel Programming 8 1st Jun 2006 08:36 PM
Subscript Out of Range Error Barb Microsoft Excel Discussion 2 11th Oct 2004 09:58 PM
Help on subscript out of range error (VB6/VBA) farmer Microsoft Excel Worksheet Functions 1 2nd Nov 2003 04:19 PM


Features
 

Advertising
 

Newsgroups
 


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