title: Excel VBA set something in Range as ActiveCell.Offset
body: <p>This is probably very basic for you guys, but I just started using VBA in Excel and eventhough I have a pretty good understanding of the logic behind the functions, I can't seem to find what I am looking for ... </p>
  
  <p>Here is my code : </p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  Dim KeyCells As Range
  
  Set KeyCells = Range("A4:A27")
  
  If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
      Dim myValue As Variant
      myValue = InputBox("Indiquer la quantité", "Quantité")
      Range("C4").Value = myValue
  
      If Cells("4", "C") &gt; 1 Then
          MsgBox (myValue &amp; " produits sélectionnés")
      End If
  
      If Cells("4", "C") &lt; 1 Then
  
      End If
  End If
  </code></pre>
  
  <p>Basically my document is a table where you select one cell after the other in range ("A4:A27"). I want the result of my InputBox to go in an Offset cell (0,2). I set "C4" so that I wouldn't get any error but obviously when I select A5 my result still goes in C4 when I would like it to go in C5....</p>
  
  <p>What is the function to use ?</p>
  
  <p>Thks for answers</p>