Thanks for the replies Dave !!
here is my code... i used the same code that you answered in my
previous post.
This code passes the name of the workbook as well as worksheet to the
the function.
It works fine if i pass the name of the file as temp.xls, but it gives
run time error 9 when I give the full path name.
Here is sample of the code:
-This statement calls the function-
CompareWorksheets
Workbooks("*c:\\temp\\temp.xls*").Worksheets("Shee t1"), _
Workbooks("c1.xls").Worksheets("Sheet1")
-This is the function that is called :-
Sub CompareWorksheets(ws1 As Worksheet, ws2 As Worksheet)
Dim r As Long, c As Integer
Dim lr1 As Long, lr2 As Long, lc1 As Integer, lc2 As Integer
Dim maxR As Long, maxC As Integer, cf1 As String, cf2 As String
Dim rptWB As Workbook, DiffCount As Long
Application.ScreenUpdating = False
Application.StatusBar = "Creating the report..."
Set rptWB = Workbooks.Add
Application.DisplayAlerts = False
While Worksheets.Count 1
Worksheets(2).Delete
Wend
Application.DisplayAlerts = True
With ws1.UsedRange
lr1 = .Rows.Count
lc1 = .Columns.Count
End With
.......
........
Thanks in advance !!!
Regards,
Jatz
--
JAtz_DA_WAY
------------------------------------------------------------------------
JAtz_DA_WAY's Profile:
http://www.excelforum.com/member.php...o&userid=26684
View this thread:
http://www.excelforum.com/showthread...hreadid=400153