title: Deleting A Row In Excel From VBE
body: <p>I have got some code that looks for a record in an excel file that contains the same characters as a textbox. I then need to delete that row, but I am not sure how to do this. Please could anybody help me?
  Here is my code:</p>
  
  <pre><code>Dim oXL As Excel.Application
      Dim oSheet As Excel.Worksheet
      Dim oRng As Excel.Range
      'create object and open workbook
      oXL = CreateObject("Excel.application")
      oXL.Workbooks.Open(CreateAdmin.FileLocation + "\DVDRental.xls")
  
      'open worksheet
      oSheet = oXL.ActiveWorkbook.Sheets("Logins")
  
      oRng = oSheet.Range("A1:A100")
  
      Dim blankspace As Integer = 1
  
      Do Until oRng(blankspace, 2).value() = ""
          If oRng(blankspace, 2).value() &lt;&gt; "" Then
              blankspace = blankspace + 1
          End If
      Loop
  
      Dim introw As Integer = 1
      Dim user As String
      Dim username As String = TextBox1.Text
  
      If username = "" Then
          MsgBox("Please Enter A User ID")
      Else
          Do
              user = oRng(introw, 2).value()
  
  
              If user = username Then
  
  
                  oXL.ActiveWorkbook.Save()
                  oXL.ActiveWorkbook.Close()
  
                  Exit Do
              Else : introw = introw + 1
  
              End If
          Loop Until introw = blankspace
  
          oRng = Nothing
          oSheet = Nothing
          oXL.Quit()
          oXL = Nothing
          TextBox1.Clear()
  </code></pre>