how to input data into textboxes and make it appear on excel cells

  • Thread starter Thread starter bo2loz el meba2laz
  • Start date Start date
B

bo2loz el meba2laz

on excel 2007, i have a visual basic code for an interface that contains 2
pushbuttons and 2 text boxes. the code for the one of the pushbuttons is as
follows:


Private Sub CommandButton1_Click()

Dim LastRow As Object

Set LastRow = Sheet1.Range("a65536").End(xlUp)


LastRow.Offset(13, 0).Value = TextBox1.Text
LastRow.Offset(13, 1).Value = TextBox2.Text

MsgBox "One record written to Sheet1"

response = MsgBox("Do you want to enter another record?", _
vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If

End Sub

in the second line of the program ive got 'End(xlUp)' which makes my second
input into the text boxes appear 10 cells below the first input. i want to
make my seecond input appear a cell below the first input. HOW ??????? :))
 
Cannot see it ending up 10 rows down? You are instructing it to enter data
13 rows down, therefore 12 below the last entry. If you change the 13 to 1,
you should write to the next line.

--
HTH

Kassie

Replace xxx with hotmail
 
thanks a lot, it WORKED :))

Kassie said:
Cannot see it ending up 10 rows down? You are instructing it to enter data
13 rows down, therefore 12 below the last entry. If you change the 13 to 1,
you should write to the next line.

--
HTH

Kassie

Replace xxx with hotmail
 
Hi All,

Kindly need your help.

I want to use button function of form control to open specific worksheet.

For Example.
In worksheet(1), I make drop down list as follow Football, Basket, Tennis.
I also already make worksheet(football), worksheet(basket), and worksheet(tennis) and hiding all these worksheets
In worksheet(1) I choose list football and I click button form control and only the worksheet(football) will open.

Any advise.
Thank you
 
Back
Top