Hi
try the following
sub foo()
dim wks as worksheet
on error resume next
set wks = worksheets("Results")
on error goto 0
if wks is nothing then
msgbox "Result sheet does not exist"
exit sub
end if
wks.activate
end sub
-----Original Message-----
Hi ya
I want to activate a certain Worksheet 'Results' using a
macro. Because
I don't know for you whether it exists yet, I want to
check that with
an If-statement and then act accordingly (create the
sheet if it's not
there yet). The expression below (.Activate) doesn't
work, nor did
using 'Not Sheets(...) Is Nothing' but I look for
something of this
kind as I would like to avoid a loop to check for the
sheets'
existence
If (Sheets("Results").Activate) Then
...
Else
Sheets.Add
ActiveSheet.Name = "Results"
End If
Any ideas are highly appreciated, cheers!
fabalicious
---
Message posted from http://www.ExcelForum.com/
.