ellehcer08
New Member
- Joined
- Jul 25, 2011
- Messages
- 31
hi!! can someone tell me how to make this code work.. (button YES, in vbYesNo is not working)
Please help!!!! thanks a lot...
Code:
Private Sub cmdDelete_Click()
Dim RecipeDel
Dim r As Range
Dim SourceDel As String
Dim CategoryDel As String
Dim faddress As String
Dim PageDel As String
With Me
CategoryDel = .lbxSearch.Column(1)
RecipeDel = .lbxSearch.Column(2)
SourceDel = .lbxSearch.Column(3)
PageDel = .lbxSearch.Column(4)
End With
With Sheets("Recipe_Page").Range("RecipeRange")
Set r = .Find(What:=CategoryDel, LookAt:=xlPart, LookIn:=xlValues, MatchCase:=False)
If Not r Is Nothing Then
faddress = r.Address
answer = MsgBox("Delete this??", vbYesNo)
If vbNo Then Exit Sub
End If
If vbYes Then
Do
If r.Offset(0, 1) = RecipeDel And r.Offset(0, 2) = SourceDel And _
r.Offset(0, 3) = PageDel Then
r.EntireRow.Delete
Exit Do
End If
Set r = .FindNext(r)
Loop While Not r Is Nothing And r.Address <> faddress
Else
MsgBox "Nothing found... Try Again!!", vbInformation + vbOKOnly
Me.txtSearch = ""
Me.txtSearch.SetFocus
End If
End With
With Me
.txtSearch.Value = ""
.txtRecipe.Value = ""
.txtPageNum.Value = ""
.cboCategory2.Value = ""
.cboSource2.Value = ""
.lbxSearch.Clear
.cmdAdd.Enabled = True
.cmdGO.Enabled = True
.cmdDelete.Enabled = False
.cmdReplace.Enabled = False
End With
End Sub
Please help!!!! thanks a lot...