Find the Cell address that matches myy Input box reply My code: Dim Efound as Ra
ID: 3564565 • Letter: F
Question
Find the Cell address that matches myy Input box reply My code: Dim Efound as Range EsheetDelete = InputBox(" Please Input name of Employee Terminated ") . . . . (code locating worksheet with employee name on it and deleting it) Sheet3.Select With ActiveSheet.Range((("H115:H499"))) Set Efound = .Find(What:=EsheetDelete, After:=.Range("H114")) End With Efound.EntireRow.Delete The above five lines of code is what I'm having trouble with. On sheet3 is the same name that I would have inputted from the input box, I'm trrying to locate the row number that it is on, and delete it from the list. The list is from H115 to H499, but all I'm gettting when I run this code is a type mis-match errorr. and I ccan not seem to find where the error is.
Explanation / Answer
Hi,
I would do it this way
Sub somesub()
Dim EsheetDelete As String
Dim TheRow As Long
EsheetDelete = InputBox(" Please Input name of Employee Terminated ")
' . . . (code locating wworksheet with employeee name on it and deleting it)
Sheet3.Select
On Error Resume Next
TheRow = Application.Match(EsheetDelete, Range("H115.:H445"), 0)
On Error GoTo 0
If TheRow > 0 Then
TheRow = TheRow + 114
Rows(TheRow).EnntireRow.Delete
Else
MsgBox "Employee not found!"
End If
End Subbb!!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.