Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default accessing worksheets from 2 excel files


Hi,
I want to compare 2 worksheets present in 2 different excel files. I
there any way to do it?
Regards,
Ashis

--
ashishpre
-----------------------------------------------------------------------
ashishprem's Profile: http://www.excelforum.com/member.php...fo&userid=3148
View this thread: http://www.excelforum.com/showthread.php?threadid=53714

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default accessing worksheets from 2 excel files


What are you trying to compare? Would copying the two sheets into one
'Comparison' workbook be appropriate? The code is simpler if you're
only swtiching sheets instead of books...

ashishprem Wrote:
Hi,
I want to compare 2 worksheets present in 2 different excel files. Is
there any way to do it?
Regards,
Ashish



--
pianoman
------------------------------------------------------------------------
pianoman's Profile: http://www.excelforum.com/member.php...o&userid=33712
View this thread: http://www.excelforum.com/showthread...hreadid=537141

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default accessing worksheets from 2 excel files


The copying will solve the problem definitely. Actually i am getting two
excel sheets daily which are needs to be compared. I am copying both the
sheets in one excel file and pasting the macro in the same excel file
and then i am running the macro to get the compared result. Its pretty
hectic.So is there any way by which i can just give the path name for 2
files and get the compared result.


--
ashishprem
------------------------------------------------------------------------
ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485
View this thread: http://www.excelforum.com/showthread...hreadid=537141

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default accessing worksheets from 2 excel files

If you write the macro to operate that way, it can open the two workbooks,
create the combined workbook and then do the comparison.

Your description is so vague, that it it is hard to say much beyond that.

What don't you know how to do.

You don't know how to open a workbook with code?
Dim fName as Variant
Dim fname1 as Variant
Dim bk as Workbook, bk1 as Workbook
Dim bk2 as Workbook, rng2 as Range
fname = Application.GetOpenfileName()
if fname < False then
set bk = workbooks.Open(fName)
end if
fName1 = Application.GetOpenfileName()
if fName1 < False then
set bk1 = Workbooks.Open(fName1)
end if
if bk1 is nothing or bk2 is nothing then
msgbox "Faild to designate two workbooks"
exit sub
end if
set bk2 = Worbooks.add
bk.worksheets(1).Range("A1").CurrentRegion.copy _
bk2.Worksheets(1).Range("A1")
set rng2 = bk2.worksheets(1).Cells(rows.count,1).end(xlup)(2)
bk1.Worksheets(1).Range("A1").CurrentRegion.copy _
rng2
bk.close Savechanges:=False
bk1.Close Savechanges:=False

conceptually, this should create a third workbook with data from each of the
first two workbooks.

--
Regards,
Tom Ogilvy





"ashishprem" wrote:


The copying will solve the problem definitely. Actually i am getting two
excel sheets daily which are needs to be compared. I am copying both the
sheets in one excel file and pasting the macro in the same excel file
and then i am running the macro to get the compared result. Its pretty
hectic.So is there any way by which i can just give the path name for 2
files and get the compared result.


--
ashishprem
------------------------------------------------------------------------
ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485
View this thread: http://www.excelforum.com/showthread...hreadid=537141


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
Accessing imported Excel files after Office 2003 SP3 upgrade kmitch Excel Discussion (Misc queries) 0 November 9th 07 01:13 PM
Accessing cells in other files [email protected] Excel Discussion (Misc queries) 4 October 5th 06 02:32 PM
Trouble accessing a couple of established Excel 97 files lkpringle Excel Discussion (Misc queries) 2 August 11th 05 12:39 AM
Accessing PowerPoint files from Excel MWE[_31_] Excel Programming 1 April 8th 04 12:36 AM
Accessing the values of form controls on worksheets in Excel 2000 robbinma Excel Programming 2 August 28th 03 08:35 AM


All times are GMT +1. The time now is 01:59 AM.

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"