title: VBA - I am having an issue with autofill code
body: <p>I use the same autofill code all my other macros. The difference with this macro is that I implemented an Input box earlier in the code for a different function. I think I am having an issue with what cell should be used to autofill the other cells.</p>
  <p>I keep getting a &quot;This operation will cause some merged cells to unmerge. Do you wish to continue?&quot; message but I already unmerged the entire sheet earlier in the code. Then VBA gives me an error: &quot;Run-time error '1004': AutoFill method of Range class failed.&quot;</p>
  <p>The correct function should use the cell &quot;ActiveCell.Offset(rowOffset:=2, columnoffset:=13).Activate&quot; as the data to auto fill down the column.</p>
  <p>Any help would be appreciated.</p>
  <p>*<strong>Edited to include successful code</strong></p>
  <pre><code>Sub Macro1()
  '
  ' Macro to cut/paste input row and autofill formula in column N
  '
  Dim myValue As Variant
      myValue = InputBox(&quot;Select Row to Move&quot;, &quot;Input&quot;, (&quot;&quot;))
  Dim sh As Worksheet, lastrow As Long
  Set sh = ActiveSheet
  
     If myValue = &quot;&quot; Then Exit Sub
     
  'Unmerge sheet'
  
  Cells.Select
  Selection.UnMerge
  
  'Select Input row, cut/paste
  
  Rows(myValue).Select
  Selection.Cut
  
  ActiveCell.Offset(rowoffset:=-1).Activate
  Selection.Insert Shift:=xlDown
  
  'select cell in column N to input formula
  
  ActiveCell.Offset(rowoffset:=2, columnoffset:=13).Activate
      Application.CutCopyMode = False
      ActiveCell.FormulaR1C1 = &quot;=+RC[-2]-RC[-1]&quot;
      
  'autofill cell down to last used row
  
   lastrow = sh.Range(&quot;B&quot; &amp; Rows.Count).End(xlUp).Row
      Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(lastrow, ActiveCell.Column)).FormulaR1C1 = &quot;=+RC[-2]-RC[-1]&quot;
          
      
       
  End Sub
  </code></pre>