User Form Data Input

  • Thread starter Thread starter krc547
  • Start date Start date
K

krc547

How do I code so a value from a combobox on a forms value will be entered
into a certain cell on a worksheet? Also item from a text box as well.
 
Try something like

Worksheets("Sheet2").Range("A1").Value = Me.ComboBox1.Value
Worksheets("Sheet2").Range("A2").Value = Me.TextBox1.Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
Similar Question, what if I have several text boxes that would put
information into one cell. For example:

My form has frames and depending on which they choose the remaining frames
become disabled. Each of these frames have a Name option. If someone enters a
name in any of these boxes it goes into cell C18.
 
Similar Question, what if I have several text boxes that would put
information into one cell. For example:

My form has frames and depending on which they choose the remaining frames
become disabled. Each of these frames have a Name option. If someone enters a
name in any of these boxes it goes into cell C18.








- Show quoted text -

Try setting the ControlSource property on each control to C18?
 
WHA said:
Try setting the ControlSource property on each control to C18?


I tried that, but comes up exception error. I need to mention thet the
spreadsheet is protected. In my code I unprotect run the form then reprotect
at the end.
 
I tried that, but comes up exception error. I need to mention thet the
spreadsheet is protected. In my code I unprotect run the form then reprotect
at the end.



- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

If protection is the problem, then you might try setting the
ControlSource property in the VBA code, something like:
Worksheet.Unprotect
MyControl.ControlSource = "C18"
....
MyControl.ControlSource = ""
Worksheet.Protect

Alternately, you can copy&paste&modifyChip's code in several different
places. Better would be to create a helper subroutine:

Sub TransferToC18(v as Variant)
MyWorksheet.Range("C18").Value = v
End Sub

and then have lots of lines like
Call TransferToC18(MyControl.Value)

Hope this helps...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top