title: VBA: Else without If Error
body: <p>I'm trying to run the following code, but I keep getting the Else without If Error in the first sub. The code is supposed to run through a column, open webpages if there is a url in the cell, then save the page info as a text file. If there is no url, then it just saves the text within that file as a text file. I can't figure out how to change the syntax to get it to work. </p>
  
  <pre><code>Sub LoopOverB()
  
  Dim myRow As Long
  
  myRow = 10
  
  While Worksheets("Input_Format_A").Cells(myRow, 2).value &lt;&gt; ""
      If InStr(1, Worksheets("Input_Format_A").Cells(myRow, 2).value, "http://", vbTextCompare) Then Call url_Test(Worksheets("Input_Format_A").Cells(myRow, 2).value, "C:\mallet\test\" &amp; Worksheets("Input_Format_A").Cells(myRow, 1).value &amp; ".txt")
          myRow = myRow + 1
      Else
          Open "C:\mallet\test\" &amp; Worksheets("Input_Format_A").Cells(myRow, 1) &amp; ".txt" For Append As #1
          Print #1, Worksheets("Input_Format_A").Cells(myRow, 2).value
          Close #1
  
          myRow = myRow + 1
      End If
  Wend
  End Sub
  
  
  Sub url_Test(URL As String, Filename As String)
  
  Dim FSO As Object
  Dim ieApp As Object
  Dim Txt As String
  Dim TxtFile As Object
  
  Set FSO = CreateObject("Scripting.FileSystemObject")
  Set TxtFile = FSO.OpenTextFile(Filename, 2, True, -1)
  
  Set ieApp = CreateObject("InternetExplorer.Application")
  ieApp.Visible = True
  ieApp.Navigate URL
  
  While ieApp.Busy Or ieApp.ReadyState &lt;&gt; 4
      DoEvents
  Wend
  
  Txt = ieApp.Document.body.innerText
  TxtFile.Write Txt
  TxtFile.Close
  
  ieApp.Quit
  
  Set ieApp = Nothing
  Set FSO = Nothing
  End Sub
  </code></pre>