title: How can I change the position of the active cell (or raise the value with one) in Excel
body: <p>After performing some formatting and date manipulation actions in a macro, I want to remove the extra rows below my list.</p>
  
  <p>I've come with the following solution, but that deletes the last line but I need to delete everything below the last line...</p>
  
  <p>Code:</p>
  
  <pre><code>'Delete garbage at the bottom:
  1)    Range("A1").Select
  2)    Selection.End(xlDown).Select
  3)    Range(Selection, Selection.End(xlDown)).Select
  4)    Range(Selection, Selection.End(xlDown)).Select
  5)    Range(Selection, Selection.End(xlToRight)).Select
  6)    Range(Selection, Selection.End(xlToRight)).Select
  7)    Selection.Delete Shift:=xlUp
  </code></pre>
  
  <p>I created this by recording a macro. What is need is to lower the activecell one row after step 2. With step 2 I place my activecell ON the last line.</p>
  
  <p>I thought about the following solution (but I don't know how to do this)</p>
  
  <p>1) After step 2. Read out the current position of the Active cell. (Selection.Address) and put in in a variable and raise it with one. 
  2) Put cursor on the new position (Range("variable").Select
  3) Do the rest of the magic.</p>
  
  <p>Anyone knows a good solution?</p>
  
  <p>UPDATE:</p>
  
  <p>To answer my question:</p>
  
  <pre><code>ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
  </code></pre>
  
  <p>This will change to position of the active cell with one row.</p>
  
  <p>But I understand that using this method is unwanted, thanks for the answers.</p>
  
  <p>My complete Macro looks like this:</p>
  
  <pre><code>Sub Function1()
  '
  ' Record Macro
  
  'Split one column in multiple cells
      Columns("A:A").Select
      Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
          FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(20, 1), Array(30, 4), Array(36, 1), _
          Array(45, 4), Array(51, 1), Array(62, 1), Array(63, 1), Array(64, 1), Array(67, 1)), _
          TrailingMinusNumbers:=True
  'Remove empty / uneeded Columns
      Columns("A:A").Select
      Selection.Delete Shift:=xlToLeft
      Columns("D:D").Select
      Selection.Delete Shift:=xlToLeft
  'Formatting Cells
      Columns("E:E").Select
      Selection.NumberFormat = "#,##0.00"
  'Insert Formula #1 on row 1
      Range("J1").Select
      ActiveCell.FormulaR1C1 = "=RC[-5]/100"
  'Autofill formula to row 5000 (There will never be more than 5000 lines)
      Selection.AutoFill Destination:=Range("J1:J5000")
      Range("K1").Select
  'Insert Formula #1 on row 1
      ActiveCell.FormulaR1C1 = "=IF(RC[-5]=""+"",RC[-1],RC[-1]*-1)"
      Range("K1").Select
  'Autofill formula to row 5000 (There will never be more than 5000 lines)
      Selection.AutoFill Destination:=Range("K1:K5000")
  'Colomn K, copy/paste as Value
      Columns("K:K").Select
      Selection.Copy
      Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
      Columns("K:K").Select
  'Remove Columns that are not needed anymore
      Columns("E:G").Select
      Selection.Delete Shift:=xlToLeft
      Columns("F:G").Select
      Selection.Delete Shift:=xlToLeft
  'Column 2 Search for "/" and remove it
      Columns("B:B").Select
      Selection.Replace What:="/", Replacement:="", LookAt:=xlPart, _
          SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
          ReplaceFormat:=False
  'Remove the unneeded Autofill lines
      Range("A1").Select
      Selection.End(xlDown).Select
      ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
      Range(Selection, Selection.End(xlDown)).Select
      Range(Selection, Selection.End(xlDown)).Select
      Range(Selection, Selection.End(xlToRight)).Select
      Range(Selection, Selection.End(xlToRight)).Select
      Selection.Delete Shift:=xlUp
  'Reset view
      Cells.Select
      Cells.EntireColumn.AutoFit
  
  End Sub
  </code></pre>
  
  <p>I know this is unwanted, but by using the Macro recording function I was able to automate some tasks and save a lot of time!! I am very curious how this code can be optimized. If someone have some ideas, please let me know!</p>