dougmarkham
Active Member
- Joined
- Jul 19, 2016
- Messages
- 252
- Office Version
- 365
- Platform
- Windows
Hi Folks,
I have found this macro which lists all the worksheet names within a workbook.
Let's say the worksheet I'm running this macro in is called 'Master' and there are 4 other worksheets in the workbook: White, Brown, Yellow, and Green. I wish to modify this code so that it returns the names of the other worksheets, not including 'Master'.
E.g., in A1 down...
White
Brown
Yellow
Green.
This will be then used as part of a reference for a formula, so I'm looking for a way of stopping the macro from including 'Master' in the list?
Would you please help me modify this code?
Kind regards,
Doug.
I have found this macro which lists all the worksheet names within a workbook.
Code:
[COLOR=#0077AA][FONT=inherit]Sub[/FONT][/COLOR][COLOR=black][FONT=Consolas] SheetNames[/FONT][/COLOR][COLOR=#999999][FONT=inherit]([/FONT][/COLOR][COLOR=#999999][FONT=inherit])[/FONT][/COLOR][COLOR=black][FONT=Consolas]
[/FONT][/COLOR][COLOR=#0077AA][FONT=inherit]For[/FONT][/COLOR][COLOR=black][FONT=Consolas] i [/FONT][/COLOR][COLOR=#A67F59][FONT=inherit]=[/FONT][/COLOR][COLOR=#990055][FONT=inherit]1[/FONT][/COLOR][COLOR=#0077AA][FONT=inherit]To[/FONT][/COLOR][COLOR=black][FONT=Consolas] Sheets.Count
[/FONT][/COLOR][COLOR=black][FONT=Consolas]Cells[/FONT][/COLOR][COLOR=#999999][FONT=inherit]([/FONT][/COLOR][COLOR=black][FONT=Consolas]i[/FONT][/COLOR][COLOR=#999999][FONT=inherit],[/FONT][/COLOR][COLOR=#990055][FONT=inherit]1[/FONT][/COLOR][COLOR=#999999][FONT=inherit])[/FONT][/COLOR][COLOR=#A67F59][FONT=inherit]=[/FONT][/COLOR][COLOR=black][FONT=Consolas] Sheets[/FONT][/COLOR][COLOR=#999999][FONT=inherit]([/FONT][/COLOR][COLOR=black][FONT=Consolas]i[/FONT][/COLOR][COLOR=#999999][FONT=inherit])[/FONT][/COLOR][COLOR=black][FONT=Consolas].[/FONT][/COLOR][COLOR=#0077AA][FONT=inherit]Name
[FONT=inherit]Next[/FONT][COLOR=black][FONT=Consolas] i [/FONT][/COLOR]
[/FONT][/COLOR][COLOR=#0077AA][FONT=inherit]End[/FONT][/COLOR][COLOR=#0077AA][FONT=inherit]Sub[/FONT][/COLOR]
Let's say the worksheet I'm running this macro in is called 'Master' and there are 4 other worksheets in the workbook: White, Brown, Yellow, and Green. I wish to modify this code so that it returns the names of the other worksheets, not including 'Master'.
E.g., in A1 down...
White
Brown
Yellow
Green.
This will be then used as part of a reference for a formula, so I'm looking for a way of stopping the macro from including 'Master' in the list?
Would you please help me modify this code?
Kind regards,
Doug.