![]() |
Find, FindNext and prompt user to delete
I'm trying to figure out how to use entries entered into a userform to
perform a find, then prompt the user to delete the row. If yes, then delete if no, find the next match. Here's the code I have so far: Private Sub cmdFindDel_Click() Sheets("Event Request Master List").Select Dim RowIndex As Integer Dim chkEventDate As Date Dim chkReqDate As Date Dim chkRequestor As String Dim FindEventDate As String Dim FindReqDate As String Dim FindRequestor As String Dim FindDept As String Dim FindTeams As String Dim FindStartTime As String Dim FindEndTime As String Dim FindDescrip As String Dim FindEnvir As String Dim FindApps As String Dim FindCMR As String RowIndex = 2 chkEventDate = Format(Me.txtEventDate.Value, "mm/dd/yy") chkReqDate = Format(Me.txtReqDate.Value, "mm/dd/yy") chkRequestor = Me.txtRequestor.Value If chkEventDate = "12:00:00 AM" Then MsgBox "Please enter the Event Date.", vbOKOnly ElseIf chkReqDate = "12:00:00 AM" Then MsgBox "Please enter the Requested Date.", vbOKOnly ElseIf chkRequestor = "" Then MsgBox "Please enter the Requestor name.", vbOKOnly End If Do Until Range("A" & RowIndex).Value = "" If Format(Range("a" & RowIndex).Value, "mm/dd/yy") = chkEventDate Then If Format(Range("b" & RowIndex).Value, "mm/dd/yy") = chkReqDate Then If Range("c" & RowIndex).Value = chkRequestor Then 'populate the form with the data Me.txtFindEventDate.Text = Range("A" & RowIndex).Value Me.txtFindReqDate.Text = Range("B" & RowIndex).Value Me.txtFindRequestor.Text = Range("C" & RowIndex).Value Me.txtFindDept.Text = Range("D" & RowIndex).Value Me.txtFindTeams.Text = Range("E" & RowIndex).Value Me.txtFindStartTime.Text = Range("F" & RowIndex).Value Me.txtFindEndTime.Text = Range("G" & RowIndex).Value Me.txtFindDescrip.Text = Range("H" & RowIndex).Value Me.txtFindEnvir.Text = Range("I" & RowIndex).Value Me.txtFindApps.Text = Range("J" & RowIndex).Value Me.txtCMR.Text = Range("K" & RowIndex).Value Range("A" & RowIndex).Select Exit Sub End If Else RowIndex = RowIndex + 1 End If Else RowIndex = RowIndex + 1 End If Loop End Sub The code finds the first entry and populates the userform just fine, but I can't figure out how to find the next match if the user doesn't want to delete the first match....???? Shelley |
All times are GMT +1. The time now is 02:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com