Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 62
Default verify if spesific sheet exist

hi,
i created a macro.... i need to check if the active work book has a sheet
named "xxx". do you know how should i do that?
thanks in advance.
--
Miri Tz.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default verify if spesific sheet exist

Try this which is case sensitive

Sub isthereanybodythere()
Dim ws As Worksheet
msg = "What sheet are you looking for"
response = InputBox(msg)
For Each ws In ActiveWorkbook.Worksheets

Name = ws.Name
Worksheets(Name).Select
If response = Name Then

msg = Name + " Sheet exists"
MsgBox (msg)
End If

Next ws

End Sub

"Miri" wrote:

hi,
i created a macro.... i need to check if the active work book has a sheet
named "xxx". do you know how should i do that?
thanks in advance.
--
Miri Tz.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 50
Default verify if spesific sheet exist



"Miri" wrote:

hi,
i created a macro.... i need to check if the active work book has a sheet
named "xxx". do you know how should i do that?
thanks in advance.
--
Miri Tz.


Hi ,
You could write a macro like the one shown below

Sub Surch()
a = Inputbox("Enter the name of the worksheet you want to search for:")
For each ws in worksheets
ws.select
If activesheet.name = a then
Msgbox ("This workbook has a sheet named " & a)
Goto last
Endif
Next
last:End Sub

This will do the trick

VJ

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default verify if spesific sheet exist

One mo

dim testWks as worksheet
set testwks = nothing
on error resume next
set testwks = activeworkbook.worksheets("xxx")
on error goto 0

if testwks is nothing then
'doesn't exist
else
'yep, it's there
end if



Miri wrote:

hi,
i created a macro.... i need to check if the active work book has a sheet
named "xxx". do you know how should i do that?
thanks in advance.
--
Miri Tz.


--

Dave Peterson
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
Go to spesific letter in a list Petya Excel Discussion (Misc queries) 1 February 15th 07 02:58 PM
How to get exact hours above a spesific time? MrHaugen Excel Discussion (Misc queries) 2 July 11th 06 04:28 PM
VBA: Make a new sheet if it doesn't exist PaulW Excel Discussion (Misc queries) 2 May 8th 06 03:45 PM
VBA, Make a new sheet if it doesn't exist PaulW Excel Discussion (Misc queries) 1 May 5th 06 05:25 PM
Verify if Comment exist in a cell Tom LeBold Excel Discussion (Misc queries) 2 September 15th 05 08:47 PM


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