find sheet from list.

A

Andy Healey

Hi All

I'm not sure if this is possible or not, but heres what I would like to do.

In a sheet called names in column A I have a list of sheet names.

I would like a macro to find the sheet that corresponds to the cell value
and perform a macro.

And then go onto the next cell in the list, and perform the same macro

as the list varies from month to month, and doesn't include the same names
each month I only want to perform the macro on names that exist.

Any help greatly appreciated

Cheers

Andy
 
T

Tom Ogilvy

Assume sheet with list of names and the named sheets are in the same
workbook.

Dim sh as Worksheet
Dim cell as Range
for each cell in Range("A1:A10")
set sh = Nothing
on Error resume next
set sh = Worksheets(cell.Value)
On Error goto 0
if not sh is nothing then
sh.Activate
' call macro
end if
Next
 

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