How to get autoscroll in a multiline textbox?

N

Nicola M

Hi all.
I'd like add to my application a locked textbox where i show what the user
does (example: You have added x value, You have modified y parameter etc). My
text box has the multiline property set to true and the scrollbars set to
VerticalScrollBar.
Unfortunately the bar appears only if the textbox get the focus but in this
case also I don't get the automatic 1 row up scrolling. The effect I want is
what of end titles of a movie. Hoping my explanation be clear wait your
suggestions or advices.
Thank you in advance.

Nicola
 
R

RadarEye

Hi Nicola,

In XL2003 I have created this:

Option Explicit

Private Sub Worksheet_Change(ByVal target As Range)
txtLog.Text = txtLog.Text & vbNewLine & "Value of " & _
target.Address & " changed into " &
target.Value
GotoLastLine target
End Sub

Private Sub Worksheet_SelectionChange(ByVal target As Range)
txtLog.Text = txtLog.Text & vbNewLine & "Selection changed to " &
target.Address
GotoLastLine target
End Sub

Private Sub GotoLastLine(target As Range)
Application.EnableEvents = False
txtLog.Activate
txtLog.CurLine = (txtLog.LineCount - 1)
target.Select
Application.EnableEvents = True
End Sub

HTH,

Wouter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top