Worksheet Reference

D

drvortex

All,

I'm really stumped here. Need to find out the function (IF) o
checking to see if a particular "Worksheet" exists. I have a macr
setup to automatically CREATE new worksheets in the same workbook
however, I have another sheet that is referencing data on the ne
worksheets on the final worksheet. Any suggestions?? This is urgen
and any info would be a great help.

J
 
L

LanceB

I don't believe you can do it as a worksheet function. You can however walk
thru the sheets collection to find a sheet name. The code listed below walks
thru each worksheet and checks the name against "Sheet2". If it exists it
places the sheet name in cell a1 of the active sheet.

Sub findit()
Dim ws As Worksheet

For Each ws In Sheets
If ws.Name = "Sheet2" Then
[a1] = ws.Name
End If
Next

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top