View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
John[_88_] John[_88_] is offline
external usenet poster
 
Posts: 205
Default copy userform input to cells

Hello Natanz,

You're almost there. Have a go with this (untested):

Dim ctl As Control

For Each ctl in Me.Controls
If ctl.Name = "ComboboxName" Then
activecell = ctl.Text
End If
Next ctl

Best regards

John

"natanz" wrote in message
oups.com...
i am writing a macro that has a series of userforms.
data entered into the first userform determines which userform you see
next.

i would like to copy the info entered into the comboboxes on that
second userform back into my spreadsheet. I know how many comboboxes
there are in each userform but i was hoping to generalize this routine,
by using a for next loop. I based the following code on something i
saw in a textbook:


dim ctl as control
for each ctl in me.controls
if typename(ctl) = "combobox" then _
activecell = me.ctl.value
activecell.offset(0,1).select
next ctl

but this doesn't work. the me.ctl.value isn't recognized. Is there
some way i can iterate through these comboboxes w/o naming each one
individually.

thanks in advance for any help you might be able to provide.