excel - Making userform with vba, commandbutton does not work -


first of i'm holland, sorry bad english.

i have excelsheet lot of records (from 10 1000, depending on user). idea dynamically make userform row of textboxes per record created. want make commandbutton per record change data in records. @ last add code userform define actions executed when commandbutton clicked.

the textboxes , commandbutton visible when userform shown, nothing happens when click commandbutton, despite fact code created @ userform.

i have examplefile, don't know how upload here.

underneath code (placed under userform)

private sub userform_initialize() dim ccntrl control dim txtb1 control dim cmb1 control  'deleting lines doesn't work yet 'with thisworkbook.vbproject.vbcomponents("efris").codemodule 'x = .countoflines 'y = sheets("data").range("a3").value 'if x > y .deletelines y, x - y 'x = .countoflines 'end ' 'sheets("data").range("a3") = x  'locatie van de userform in het midden van het scherm plaatsen 'breedte van de userform aanpassen aan de breedte van het scherm 'hoogte van de userform aanpassen aan de hoogte van het scherm = application.width b = application.height efris.left = 5 efris.width = - 25 efris.height = b - 50  'e = de .left van de eerste tekstbox e = 100  'f = het aantal records in de sheet ("fris") f = sheets("fris").range("b10000").end(xlup).row - 2  'a de loop in rijen = 1 f 'b = de loop in kolommen b = 1 8 if b = 1 c = "a" if b = 2 c = "b" if b = 3 c = "c" if b = 4 c = "d" if b = 5 c = "e" if b = 6 c = "f" if b = 7 c = "g" if b = 8 c = "h" 'if b = 9 c = "i" 'if b = 10 c = "j"  'breedte per textbox if b = 1 d = 30 if b = 2 d = 100 if b = 3 d = 100 if b = 4 d = 130 if b = 5 d = 150 if b = 6 d = 150 if b = 7 d = 150 if b = 8 d = 50 'if b = 9 d = 100 'if b = 10 d = 30  set txtb1 = controls.add("forms.textbox.1", "tb" & & b, true) txtb1     .height = 20     .width = d     .left = e     .top = 5 + (a * 20)     .value = sheets("fris").range("a2").offset(a, b)     .locked = true end  '.left van de textbox e = e + d  next 'e resetten naar 100 e = 100  set cmb1 = controls.add("forms.commandbutton.1") cmb1     .caption = "wijzigen"     .height = 20     .width = 90     .left = 5     .top = 5 + (a * 20) end  thisworkbook.vbproject.vbcomponents("efris").codemodule x = .countoflines sheets("data").range("a3") = x '.insertlines x + 1, "private sub " & cmb1.name & "_click()" '.insertlines x + 2, "astart.show" '.insertlines x + 3, "unload me" '.insertlines x + 4, "end sub" end   'g bepaald de totale hoogte van de userform voor de scrollbar g = 20 + * 20 next  efris.scrollbars = fmscrollbarsvertical efris.scrolltop = 0 efris.scrollheight = g  efris.show  end sub 

assign code button created dynamically

the above may you. need assign code button. there 2 methods on how in link above.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -