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: 32
Default Check if sheet exists in a closed workbook

Hi all,

Is it possible to determine whether a sheet exists in a workbook without
opening it?

I am creating links to a closed workbook in the active workbook (Thanks to
Tom, Rowan, Ron and Dave for all the help) but have found that the "same"
sheet has different names in different workbooks i.e. the name could be
either Inv Summ or Invoice Summary. I have tried to add a check for this
but the builtin Excel "select sheet to update values from" dialog pops up
before my check is completed.

Any ideas?

Below is the code:

Sub NewGetData(fName As String, SheetName As String, _
Rnge As String, Location As Range, bBool As Boolean)
Dim fName1 As String, fName2 As String
Dim sStr As String
On Error GoTo SomethingWrong
Restart:
fName1 = Left(fName, InStrRev(fName, "\"))
fName2 = "[" & Right(fName, Len(fName) - Len(fName1)) & "]"
sStr = "='" & fName1 & fName2 & SheetName & "'!" & Rnge
rng.Formula = sStr
Exit Sub
SomethingWrong:
If SheetName = "Invoice Summary" Then
SheetName = "Inv Summ"
ElseIf SheetName = "Inv Summ" Then
SheetName = "Invoice Summary"
End If
GoTo Restart

End Sub

Thanks!!

FD


 
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
check if sheet exists mohavv Excel Discussion (Misc queries) 1 November 21st 07 01:58 AM
check if the sheet/tag exists Alex Excel Worksheet Functions 2 March 14th 06 08:58 PM
check to see if sheet exists Wandering Mage Excel Programming 1 September 28th 04 07:53 PM
Check to see if sheet exists Steph[_3_] Excel Programming 4 September 22nd 04 12:47 AM
check if sheet exists Ross[_6_] Excel Programming 3 July 25th 03 06:46 PM


All times are GMT +1. The time now is 10:16 AM.

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"