OzGrid

How to use a Macro to Auto-Scroll

< Back to Search results

 Category: [Excel]  Demo Available 

How to use a Macro to Auto-Scroll

 

Requirement:

 

The user's problem is that they are using an aplication to read the data in the TCP/IP port and send it to excel using DDE(Dynamic Data Exchange).

 

The aplication is "TWedge", so what the user needs is a macro to keep seeing the data on the screen when new data is placed in a row because the program does not simulate keystrokes.

 

The user has tried this code, but it only works when the user himself/herself executes it:


Sub Scroll()

Dim i As Long: i = 1
Do While Len(Cells(i, "A").Value2) > 0
ActiveWindow.ScrollRow = i
i = i + 1
Loop

End Sub

 

Solution:

 

You could use an event macro :

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Application.Goto Range("A" & Target.Row), True
End Sub

 

Obtained from the OzGrid Help Forum.

Solution provided by Carim.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to automate charts with 1 x - axis and multiple y - axis in VBA
How to auto populate blank cells using VBA
How to auto copy data from master list to sub worksheets based on data value in one column
How to auto populate comment box when cell value changes

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.

 

 


Gallery



stars (0 Reviews)