title: excel 2010 vba send keys to simulate clicking the formula bar
body: <p>Google hasn't given me quite what I want, I thought maybe SO might have the answer. </p>
  
  <p>Instead of using a input box or user prompt that asks the user for info that will be stored in cell, I'm looking for some code to simulate clicking in the formula bar. I am currently using sendkeys method with "F2" to allow the user to enter info into the selected cell. It would be much easier to look into the formula bar, instead of a single cell in a sea of data. </p>
  
  <pre><code>Sub CopyTemplate()
  
  'ActiveWorkbook.Save
  Worksheets("HR-Cal").Activate
  Dim rng As Range
  Dim trng As Range
  Dim tco As String
  'Use the InputBox select row to insert copied cells
  Set rng = Application.InputBox("select row to paste into", "Insert template location", Default:=ActiveCell.Address, Type:=8)
  If rep = vbCancel Then
  End If
  
  startrow = rng.Row
  '  MsgBox "row =" &amp; startrow
  Range("AG2") = startrow
  
  Application.ScreenUpdating = False
  
  'copy template block
  Range("C6").End(xlDown).Select
  Range("AG1") = ActiveCell.Row
  
  tco = "A5:AN" &amp; Range("AG1")
  Range(tco).Select
  Selection.Copy
  
  Range("A" &amp; Range("AG2")).Activate
  Selection.Insert Shift:=xlDown
  
  Range("c100000").End(xlUp).Select
  Selection.End(xlUp).Select
  'select first value
  
  Range("AG1:AG2").ClearContents
  
  Application.ScreenUpdating = True
  
  SendKeys "{F2}"
  SendKeys "{BS}"
  
  End Sub
  </code></pre>
  
  <p>when the codes runs this is what the user sees (col 2 col 2621)<a href="https://i.stack.imgur.com/2swZ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2swZ5.png" alt="enter image description here"></a></p>