redspanna
Well-known Member
- Joined
- Jul 27, 2005
- Messages
- 1,602
- Office Version
- 365
- Platform
- Windows
HI all,
I have this code that simply copies the values input in Textbox1 and Textbox2 on next available row in the 'songs' sheet
but the Textbox2 value isn't being copied -- why ??
many thanks
I have this code that simply copies the values input in Textbox1 and Textbox2 on next available row in the 'songs' sheet
Code:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("songs")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
'check for a part number
If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
MsgBox "Please enter Artist Name"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 3).Value = Me.TextBox1.Value
ws.Cells(iRow, 2).Value = Me.TextBox2.Value
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
MsgBox "New Track added, thanks!"
End Sub
but the Textbox2 value isn't being copied -- why ??
many thanks