Multi-line Textbox focus bug

Trick to force textbox with multiple lines and scrollbars to refresh itself without jumping the cursor to be at the end of the text area once that textbox had the focus
Annoying issue in Excel-VBA caused cursor in textbox to be at end of containing text when user clicks (jump focus).
Main solution is that we move the cursor to start of text in that textbox every time we change content.

CodeFunctionName
What is this?

Public

Tested

Original Work
' So, if TxtY2 is the name of that multi-line-with-scrolbars textbox ...
' Call below every time you change text in textbox
Sub Where_WeChanged_TheText(Texx2)
TxtY2.Text = Texx2
TxtY2.SelStart = 0
End Sub
' Then add below in built-in event "_Enter" to force refresh
Private Sub TxtY2_Enter()
TxtY2.SelStart = Len(TxtY2.Text)
TxtY2.SelStart = 0
TxtY2.SetFocus
End Sub

Views 3,244

Downloads 1,448

CodeID
DB ID

ANmarAmdeen
608
Revisions

v1.0

Thursday
June
7
2018