Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Abbie Cohen   on Nov 28 In MS Office Category.

  
Question Answered By: Andrew Brown   on Nov 28

Here is the code  I am currently using for the add  button, plus what
I have so far for the delete  button. I need to fill in the gap for
the find  the TextName.Value in the list  located on the "Resources"
worksheet and delete the name.

-------------------------------
Private Sub cmdAdd_Click()

Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Resources")


'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a name
If Trim(Me.TextName.Value) = "" Then
Me.TextName.SetFocus
MsgBox "Please enter a name"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.TextName.Value


'clear the data
Me.TextName.Value = ""


End Sub


Private Sub CmdDel_Click()
Dim smessage As String
Dim ws As Worksheet
Set ws = Worksheets("Resources")

smessage = "Are you sure you want to delete " + TextName.Text
+ "?"
If MsgBox(smessage, vbQuestion + vbYesNo, _
"Confirm Delete") = vbYes Then


End If

End Sub

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 


Tagged: