G
Guest
Based on a response to a previous post, I'm using Worksheet.CodeName to access a name for a worksheet that doesn't change if the user renames the sheet. However, I'm having problems getting my code to work...
First I created a workbook and added a macro that calls Excel.Worksheets.Add. I ran the macro a few times to create a few sheets and closed and saved the workbook. When I open the workbook again, my code loops through the worksheets collection, displaying the sheet name and code name - all the code names are blank. If I run the macro to create a new sheet and then loop through the worksheets collection again, sheet name and code name both display correctly.
Any ideas why I get this behavior?
- Drew
First I created a workbook and added a macro that calls Excel.Worksheets.Add. I ran the macro a few times to create a few sheets and closed and saved the workbook. When I open the workbook again, my code loops through the worksheets collection, displaying the sheet name and code name - all the code names are blank. If I run the macro to create a new sheet and then loop through the worksheets collection again, sheet name and code name both display correctly.
Any ideas why I get this behavior?
- Drew