ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   insert lines into CODEMODULE gives error (https://www.excelbanter.com/excel-programming/311208-insert-lines-into-codemodule-gives-error.html)

Marek

insert lines into CODEMODULE gives error
 

people, i 'am creating dynamically 3 worksheets, and on each worksheet
have from 0 to X number of dynamically created controls llike combobox

when i'm finishing create one of 3 sheets, i try to create events t
all comboboxes which i'm create


-----------------------------------
Dim evnt As Long
Dim cm As CodeModule

cnames = Array("s201", "s202")

For Each v1 In cnames
With Worksheets(v1)
.Activate

Set cm
ActiveWorkbook.VBProject.VBComponents(.CodeName).C odeModule

v2 = "worker1"
evnt = cm.CreateEventProc("change", v2)

v2 = "worker2"
evnt = cm.CreateEventProc("change", v2)

Set cm = Nothing

End With
Next
---------------------------------------

here is a very simple of code,
problem is when my code try to create this code in the next sheet (i
array next value ), then excel hang up

where is the problem ????


thank you :

--
Mare
-----------------------------------------------------------------------
Marek's Profile: http://www.excelforum.com/member.php...fo&userid=1376
View this thread: http://www.excelforum.com/showthread.php?threadid=26289



All times are GMT +1. The time now is 08:52 AM.

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