Populate a cell with TextBox info

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to populate a specific cell with information entered on my userform in
Textbox1. It will always be the same cell so I will not need to put new
input on next line. Thank you in advance for your help.
 
Hi Sony

on the OK button of the userform the code would look something like this

Sheets("Sheet1").Range("A1").value = textbox1

Hope this helps

Cheers
JulieD
 
Assume that you have a command button (CommandButton1) on the same user form,
place the folowing code in the Declarations portion of your form:

Private Sub CommandButton1_Click()
Dim rRargetCell As Range
Set rtargetcell = ThisWorkbook.Sheets("Sheet1").Range("a1")
c.Value -TextBox1.Value
End Sub

Regards,

Alasdair Stirling
 
I believe you meant it will not always be the same cell. Assume textbox1 is
on a Userform

Private Sub TextBox1_Exit(ByVal Cancel _
As MSForms.ReturnBoolean)
Dim rng as Range
With worksheets(1)
set rng = .cells(rows.count,1).End(xlup)
End with
if not isempty(rng) then set rng = rng.offset(1,0)
rng.value = Textbox1.Value
End sub

Assumes you will want to start in A1 of sheet1 and progress down the column.
 
Why not just use the controlsource (userform) property to link the textbox
to the cell.
 

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