View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Scott Scott is offline
external usenet poster
 
Posts: 17
Default checking visible sheets.

Thank very much Tom for your help.

I have a question, how do I make each sheet activate one at a time that's
not in the array.
Dim varr as variant, res as variant
Dim sh as worksheet
varr = Array("Sheet3","Sheet9","Data","AAAA")
for each sh in thisworkbook.worksheets
if sh.Visible = xlSheetVisible then
res = Application.Match(sh.name,varr,0)
if iserror(res) then
' not found in the list, do code
' Activate sheet here, but don't know how.
end if
end if
Next


Hope someone can help,
Thanks
best regards,
Scott





"Tom Ogilvy" wrote in message
...
Dim varr as variant, res as variant
Dim sh as worksheet
varr = Array("Sheet3","Sheet9","Data","AAAA")
for each sh in thisworkbook.worksheets
if sh.Visible = xlSheetVisible then
res = Application.Match(sh.name,varr,0)
if iserror(res) then
' not found in the list, do code
end if
end if
Next

--
Regards,
Tom Ogilvy

"Scott" wrote in message
...
Hi,

Can someone please help,

I'm trying to create this code which does the following:-
check visible sheets only, not hidden sheets.

check the first sheet
if it is equal to a list of names in an array then goto the next sheet
if it is not equal to a any of the names in an array then do some code
(which I have created)
then goto the next sheet and do the same again

Can someone please help,
Thanks
Best regards,
Scott