title: VBA evaluate an adjacent cell before pasting inside of a loop
body: <p>The following VBA code in excel is copying a section from a sheet ("Copy model") and pasting it into another sheet ("paste model") first available blank row. </p>
  
  <p>My Inputs sheet has a column with names and a second column to the with level. The code pastes the name in "B3", but I have a level that I manually change in B4 so the model roles up at a different level.</p>
  
  <p>I want to adjust the code to evaluate whether the level has changed, and if so, paste the new adjacent level.</p>
  
  <p>Inputs is set up like (starting at "B172"). I want to evaluate column "C" (PL/ML) before pasting the value from C. This speeds up my code a lot.</p>
  
  <p>Paste (name) into "B3"
  Paste (Level) into "B4" if the adjacent level does not = what is already in "B4"    </p>
  
  <pre><code>(Col B)  (Col C)  
  Jim       PL
  Bod       PL
  Todd      PL
  Nick      ML
  Steve     ML
  </code></pre>
  
  <p>The VBA:</p>
  
  <pre><code>Sub Loopfor()
  
      Sheets("Inputs").Select
  
      Dim rng As Range, cell As Range
      Set rng = Range("B172:B187")
  
      Dim copySheet As Worksheet
      Set copySheet = Worksheets("Copy Model")
  
      Dim pasteSheet As Worksheet
      Set pasteSheet = Worksheets("Paste model")
  
      ''Application.ScreenUpdating = False
  
      Do
  
          For Each cell In rng
  
              cell.Copy
              Range("B3").PasteSpecial Paste:=xlPasteValues
  
              copySheet.Range("A143:W264").Copy
              pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
              Application.CutCopyMode = False
  
              Sheets("Inputs").Select
  
          Next cell
  
      Loop Until IsEmpty(ActiveCell.Value)
  
      ''Application.ScreenUpdating = True
  
  End Sub
  </code></pre>