Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() hie, How do i check whether the worksheet by the name of "results" exist o not? thankx in advanc -- ajitpalsingh20 ----------------------------------------------------------------------- ajitpalsingh200's Profile: http://www.excelforum.com/member.php...fo&userid=1615 View this thread: http://www.excelforum.com/showthread.php?threadid=27651 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() For Each sht In Worksheets if sht.Name = "results" then msgbox "results exists" exit function end if Next - Manges -- mangesh_yada ----------------------------------------------------------------------- mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047 View this thread: http://www.excelforum.com/showthread.php?threadid=27651 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this:
Sub CheckSheet() On Error GoTo erHandler If ThisWorkbook.Sheets("results").Index 0 Then MsgBox "Sheet1 exists" Exit Sub End If erHandler: MsgBox "Sheet1 does not exist" End Sub KL "ajitpalsingh200" wrote in message ... hie, How do i check whether the worksheet by the name of "results" exist or not? thankx in advance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=276513 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry, here is the correct version:
Sub CheckSheet() On Error GoTo erHandler If ThisWorkbook.Sheets("results").Index 0 Then MsgBox "sheet Results exists" Exit Sub erHandler: MsgBox "sheet Results does not exist" End Sub "KL" wrote in message ... try this: Sub CheckSheet() On Error GoTo erHandler If ThisWorkbook.Sheets("results").Index 0 Then MsgBox "Sheet1 exists" Exit Sub End If erHandler: MsgBox "Sheet1 does not exist" End Sub KL "ajitpalsingh200" wrote in message ... hie, How do i check whether the worksheet by the name of "results" exist or not? thankx in advance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=276513 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ANother option
Check with If SheetExists("results") Then ... '----------------------------------------------------------------- Function SheetExists(Sh As String, _ Optional wb As Workbook) As Boolean '----------------------------------------------------------------- Dim oWs As Worksheet If wb Is Nothing Then Set wb = ActiveWorkbook On Error Resume Next SheetExists = CBool(Not wb.Worksheets(Sh) Is Nothing) On Error GoTo 0 End Function -- HTH RP (remove nothere from the email address if mailing direct) "ajitpalsingh200" wrote in message ... hie, How do i check whether the worksheet by the name of "results" exist or not? thankx in advance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=276513 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Does worksheet exist | Excel Discussion (Misc queries) | |||
Does Worksheet Exist | Excel Discussion (Misc queries) | |||
Does a worksheet exist | Excel Programming | |||
Does worksheet exist | Excel Programming | |||
check if a worksheet exist - VBA | Excel Programming |