ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I create a worksheet in a routine and set the code name at (https://www.excelbanter.com/excel-programming/373036-how-can-i-create-worksheet-routine-set-code-name.html)

kataiwo

How can I create a worksheet in a routine and set the code name at
 
Gurus please help me out.
How can I create a worksheet in a routine and set the code name at the same
time.
I presently have a routine that ran fine from the immediate window, but
fails when I call it from my form. I got the "out of range" error.
--
kataiwo

NickHK[_3_]

How can I create a worksheet in a routine and set the code name at
 
I seem to remember there are some restrictions on this, because some
propertties do not exist in the VBE until they are used.
So if you are creating a WS, whilst it exist in the WB (you can see it), it
does "exist" for the purposes of the VBE.
From the Immediate window it will work, because the VBE is open/visible and
consequently that object must be present.
IIRC, you can call some property/method/anything on the newly created WS
first, then the .CodeName will be available.

NickHK

"kataiwo" ...
Gurus please help me out.
How can I create a worksheet in a routine and set the code name at the
same
time.
I presently have a routine that ran fine from the immediate window, but
fails when I call it from my form. I got the "out of range" error.
--
kataiwo




Bob Phillips

How can I create a worksheet in a routine and set the code name at
 

"NickHK" wrote in message
...

IIRC, you can call some property/method/anything on the newly created WS
first, then the .CodeName will be available.


Force a recompile

Application.VBE.CommandBars.FindControl(ID:=578).E xecute




All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com