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

Hi,

I'm using excel to compare two files, test.xls (generated) and base.xl
(my standard template against which all my test files will be compare
against). I have found a script a
http://www.exceltip.com/st/Compare_t...xce l/477.htm
which compares two workbooks.

I went and copied both subroutines into base.xls and modified th
TestCompreWorksheets() to

Sub TestCompareWorksheets()
' compare two different worksheets in the active workbook
' CompareWorksheets Worksheets("Sheet1"), Worksheets("Sheet2")
' compare two different worksheets in two different workbooks
CompareWorksheets ActiveWorkbook.Worksheets("Sheet1"), _
Workbooks("test.xls").Worksheets("Sheet1")
End Sub

and everything worked, i.e. it told me when and where the cells didn'
match up right.

Then I created another two identical excel files, test2.xls (which i
the equivalent to my base.xls) and test2a.xls (which is equivalent t
my generated test result), and I copied and pasted the same thing int
test2.xls, and changed TestCompareWorksheets to

Sub TestCompareWorksheets()
' compare two different worksheets in the active workbook
' CompareWorksheets Worksheets("Sheet1"), Worksheets("Sheet2")
' compare two different worksheets in two different workbooks
CompareWorksheets ActiveWorkbook.Worksheets("Sheet1"), _
Workbooks("test2a.xls").Worksheets("Sheet1")
End Sub

and now I get "run-time error '9': Subscript out of range" Am I missin
something here? N.B. I'm a first time user of Excel scripts but though
that this post would be more approapriate in the programming sectio
rather than the new user section

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook comparison results in subscript out of range error

whatisexcel,

In your test2 did you want

Workbooks("test2a.xls").Worksheets("Sheet1")

or

Workbooks("test2.xls").Worksheets("Sheet1")


Charle

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook comparison results in subscript out of range error

I want test2 to be tested against test2a, so I'm guessing it's
Workbooks("test2a.xls").Worksheets("Sheet1")


---
Message posted from http://www.ExcelForum.com/

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
Error:Subscript out of range Jay Excel Discussion (Misc queries) 1 April 10th 08 10:25 PM
Subscript out of range error Tom Ogilvy Excel Programming 0 December 10th 03 12:48 AM
Help on subscript out of range error (VB6/VBA) farmer[_2_] Excel Programming 2 November 2nd 03 04:19 PM
Excel Macro Problem, Add-in need to work in every workbook & Error:9 Subscript out of range Burak[_2_] Excel Programming 1 October 31st 03 08:09 PM
Subscript out of range error Gary[_4_] Excel Programming 1 August 13th 03 07:20 AM


All times are GMT +1. The time now is 09:41 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"