View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
WHA WHA is offline
external usenet poster
 
Posts: 21
Default User Form Data Input

On Nov 29, 6:50 pm, krc547 wrote:
"WHA" wrote:
On Nov 29, 5:44 pm, krc547 wrote:
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.


"Chip Pearson" wrote:
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)


"krc547" wrote in message
...
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.- Hide quoted text -


- Show quoted text -


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.



- 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...