LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sheet Exists in another file?

Hi
I have files of the following kind in a single folder.

File 1 :
Workbook1 name = Anything
Sheet1 name = ABC
Sheet2 name = DEF
Sheet3 name = GHI etc

and several files each with the naming convention
Workbook2 name = ABC
Sheet1 name = ABC

Workbook3 name = DEF
Sheet1 name = DEF

etc. Basically I have a workbook each for each sheet in File 1. There
is a chance that some of the workbooks may have their name misspelt and
also the sheets may be misspelt.

I open the workbook corresponding to the sheet name in File 1 copy some
of its contents and close the other file.

I need to check if the workbook and sheet with the correct name exists.
I am able to track the presence of filename by:

Sub Macro1()
myfile = ActiveSheet.Name
mypath = ActiveWorkbook.Path
If Dir(mypath & "\" & myfile & ".xls") < "" Then
MsgBox "File Found"
Else
MsgBox "Not Found!"
End If
End Sub

If the relevant file is found how can I detect if the sheet with the
same name also exists in that file i.e. if myfile & ".xls" is found
then is myfile & ".xls!" & myfile also found?

Thanks
Utkarsh

 
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
Checking if Sheet Exists? [email protected] Excel Discussion (Misc queries) 5 September 1st 06 03:27 PM
Sheet name already exists eddie_zoom Excel Discussion (Misc queries) 1 March 11th 05 02:53 PM
Rename sheet if exists Phil Floyd Excel Programming 6 April 5th 04 06:58 PM
How can I know if a sheet exists ? Ben.C Excel Programming 3 December 29th 03 09:36 AM
the file already exists - do you want to replace the existing file? Paul James[_3_] Excel Programming 4 December 12th 03 02:50 AM


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