Thread: Form
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Form

Hi Darren,
Make a fix In line
Cells(time, 1) = TextBox2.Text

to
Cells(time, 2) = TextBox2.Text


Regards,
Stefi

€˛Darren€¯ ezt Ć*rta:

i am trying to set up a user form where a first name and last name are
entered. The first name must be inserted under column a and last name under
column b.

Here is the code that i am using:

Private Sub CommandButton1_Click()

Dim ans As String
Dim time As String

Sheets("sheet1").Activate
ans = Application.WorksheetFunction.CountA(Range("a:a")) + 1
Cells(ans, 1) = TextBox1.Text
TextBox1.Text = ""

time = Application.WorksheetFunction.Count(Range("b:b")) + 2
Cells(time, 1) = TextBox2.Text
TextBox2.Text = ""


End Sub

This throws both under column a