find sheet from list.
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 |
find sheet from list.
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 -- Regards, Tom Ogilvy Andy Healey wrote in message ... 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 |
find sheet from list.
Hi Tom
It works an absolute dream, thanks a lot cheers Andy "Tom Ogilvy" wrote in message ... 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 -- Regards, Tom Ogilvy Andy Healey wrote in message ... 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 |
All times are GMT +1. The time now is 02:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com