P
Pam Field
Thanks to those who helped earlier. I have two more questions (I hope
that's all). Once again my code so far is:
Private Sub cmdRemChild_Click()
Dim myCell As Range
Dim ChosenName As String
Dim NameFound As Boolean
Dim YesNo As Integer
ChosenName = cboChildName.Text
Sheets("Child Records").Select
NameFound = False
For Each myCell In Range("Name_of_Child")
If myCell.Value = ChosenName Then
myCell.Select
NameFound = True
Unload Me
Exit For
End If
Next myCell
If NameFound = False Then
MsgBox "Name not entered or not Found!"
cboChildName.SetFocus
End If
YesNo = MsgBox("Are you sure you want to remove this child?", vbYesNo +
vbExclamation, "Caution")
Select Case YesNo
Case vbYes
Selection.Delete Shift:=xlUp
Range("A6").Select
Case vbNo
frmRemChild.Show
End Select
End Sub
________________________
If I click on the cmdRemChild button without choosing a name I get msgBox
"Name not entered ......." - I click on no for this and it goes straight to
msgBox "Are you sure .........". What I want to happen if I don't choose a
name is for it to SetFocus on cboChildName. (It does this if I click on the
no from the msgBox "Are you sure .... etc".
Last problem (I hope) is that I want it to delete the entire row not just
the cell the name is in. Can someone please explain how I do this?
Thanks again so much for your help so far.
Regards
Pam
that's all). Once again my code so far is:
Private Sub cmdRemChild_Click()
Dim myCell As Range
Dim ChosenName As String
Dim NameFound As Boolean
Dim YesNo As Integer
ChosenName = cboChildName.Text
Sheets("Child Records").Select
NameFound = False
For Each myCell In Range("Name_of_Child")
If myCell.Value = ChosenName Then
myCell.Select
NameFound = True
Unload Me
Exit For
End If
Next myCell
If NameFound = False Then
MsgBox "Name not entered or not Found!"
cboChildName.SetFocus
End If
YesNo = MsgBox("Are you sure you want to remove this child?", vbYesNo +
vbExclamation, "Caution")
Select Case YesNo
Case vbYes
Selection.Delete Shift:=xlUp
Range("A6").Select
Case vbNo
frmRemChild.Show
End Select
End Sub
________________________
If I click on the cmdRemChild button without choosing a name I get msgBox
"Name not entered ......." - I click on no for this and it goes straight to
msgBox "Are you sure .........". What I want to happen if I don't choose a
name is for it to SetFocus on cboChildName. (It does this if I click on the
no from the msgBox "Are you sure .... etc".
Last problem (I hope) is that I want it to delete the entire row not just
the cell the name is in. Can someone please explain how I do this?
Thanks again so much for your help so far.
Regards
Pam