问题
I am trying to create a named range for a worksheet that does not yet exist in the workbook. I will be using a macro to import a user-defined text file as the source.
Am I restricted to only defining these named ranges once the worksheet has been imported, or can I name a future range on a sheet that does not exist yet?
回答1:
In Refers to:
=INDIRECT("NotYetASheet!$A$1")
回答2:
I'm assuming the names will be created upon import of the data. I'm also assuming it's ok if your unnamed ranges return errors until the data has been imported. You can manage this using the IFERR or IFERROR functions.
Enter the following in a cell of a new worksheet:
=notyetnamed
Then select another cell, enter any old value, and give it the name notyetnamed.
I hope this answers your question. If not, you're welcome to clarify and I'll do my best to help.
来源:https://stackoverflow.com/questions/15079169/is-it-possible-to-name-a-range-on-a-sheet-that-does-not-exist-yet