title: VBA Excel: ListBox scrolling automatically
body: <p>I'm trying to make it such that the <code>ListBox</code> will auto-scroll to the newest entry upon input via the <code>commandbutton</code>:</p>
  <pre class="lang-vb prettyprint-override"><code>Private Sub CommandButton1_Click()
      TextBox1.Text = &quot;newentry&quot;
      ListBox1.AddItem TextBox1.Value
      ListBox1.TopIndex = ListBox1.Item.Count - 1
  End Sub
  </code></pre>
  <p>I'll get a compile error for this. I've tried various syntax combinations to no avail.</p>
  <p>Appreciate the help for this.</p>