title: Qualifier errors when attempting to debug, along with final lines -- help pls
body: <p>Below is the code i have put together from various examples to try achieve my goal. Concept is to be dynamic and retrieve from survey sheet within my workbook, to be able to obtain the corresponding TVD for the MD
  --Use while loop only to run code if there is a depth in Column B Present. Nested loop uses the difference between depths to calculate a gradient. 
  ---The issue i'm having is getting past my first debug error "Invalid Qualifier".
  ----Lastly, any suggestions for how i would then return the TVD to Column A, relevant to the looked up MD, within the nested loop to maintain the row in which the MD was grabbed. Sorry for making this so wordy, been working on this for over 10hrs while at work.</p>
  
  <p><a href="http://www.wellog.com/tvd.htm" rel="nofollow">http://www.wellog.com/tvd.htm</a></p>
  
  <pre><code>Sub MdtoTVD()
  
  Dim MD1 As String, MD2 As Integer
  Dim TVD1 As String, TVD2 As Integer
  Dim Srng As Range 'Survey MD column
  Dim MDrng As Range 'MdtoTVD MD column as range
  Dim MDdiff As Integer ' Var to calculate difference of MD end from MD start
  Dim TVDdiff As Integer ' Var to calculate difference of TVD end from TVD start
  Dim TVDincr As Double ' var to use for stepping TVD
  Dim MDrow As Integer
  Dim i As Long
  
  MDrng = Range("Surveys!B27:B215") 'range from the survey sheet within my report book
  Srng = Range("Surveys!G27:G215") 'range from the survey sheet within my report book
  
  
  
  Dim X As Integer
  X = 2
  While Not (IsEmpty(Sheets("MDtoTVD").Cells(X, 2).Value)) 'runs loop as long as there a MD depth to be looked up
  Cells(X, 2) = MDrow 'assigns current row value to for MD input
  MD1.Value = Application.WorksheetFunction.Index(Srng, Application.WorksheetFunction.Match(MDrow, MDrng, 1)) ' retrieves Start point for MD
  MD2.Value = Application.WorksheetFunction.Index(Srng, Application.WorksheetFunction.Match(MDrow, MDrng, 1) + 1) 'retrieves end point for MD
  TVD1.Value = Application.WorksheetFunction.Index(MDrng, Application.WorksheetFunction.Match(MDrow, Srng, 1)) 'retrieves start point for TVD
  TVD2.Value = Application.WorksheetFunction.Index(MDrng, Application.WorksheetFunction.Match(MDrow, Srng, 1) + 1) 'retrieves end point for TVD
  MDdiff.Value = (MD2 - MD1) 'assigns and calculates difference of MD end from MD start
  TVDdiff.Value = (TVD2 - TD1) 'assigns and calculates difference of TVD end from TVD start
  TVDincr.Value = MDdiff / TVDdiff 'Divides MD by TVD to get increment per foot
  
  For i = 1 To MDdiff Step TVDincr 'set max loop run to amount of feet between survey points
  Cells(X, 1).Value = TVD1 + i 'uses the loop to increment the TVD from start point
  Next i
  
  Wend
  End Sub
  </code></pre>