M
Marcus Pedersén
Hi!
I use a userform to add new rows in a table but I get an error:
"User-defined type not defined" and I can not figure out the problem. I´m
using the following code and the error row is marked *.
Private Sub CommandButton1_Click()
* Dim LastRow As Object
Set LastRow = Sheet1.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.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 = ""
TextBox3.Text = ""
TextBox1.SetFocus
Else
Unload Me
End If
End Sub
......a second question. I want the frames around the cells with the text
that is added to be "painted" black when I click "Add to record" how do I do
that?
Many, many, many thanks in advance!!!
Marcus
I use a userform to add new rows in a table but I get an error:
"User-defined type not defined" and I can not figure out the problem. I´m
using the following code and the error row is marked *.
Private Sub CommandButton1_Click()
* Dim LastRow As Object
Set LastRow = Sheet1.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.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 = ""
TextBox3.Text = ""
TextBox1.SetFocus
Else
Unload Me
End If
End Sub
......a second question. I want the frames around the cells with the text
that is added to be "painted" black when I click "Add to record" how do I do
that?
Many, many, many thanks in advance!!!
Marcus