Macro to Auto-Scroll

IvanCG

New Member
Joined
Sep 13, 2018
Messages
3
Hi, my problem is that i'm 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 i need 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. Thanks .


So far i've tried this code, but it only works when i execute it.


Sub Scroll()

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

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
HI,
when you put your code into the worksheet_Change Event does it do what you are after?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long: i = 1
Do While Len(Cells(i, "A").Value2) > 0
ActiveWindow.ScrollRow = i
i = i + 1
Loop
End Sub

HTH
 
Upvote 0
HI,
when you put your code into the worksheet_Change Event does it do what you are after?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long: i = 1
Do While Len(Cells(i, "A").Value2) > 0
ActiveWindow.ScrollRow = i
i = i + 1
Loop
End Sub

HTH

Hi , thanks for the reply.
I tried your solution but it doesn't work ,the data keeps going on the screen and it doesn't follow it.
It seems that this only works when you manually select the row or click enter after a data input.
The program that i'm using is putting the data in the rows without selecting them , neither is using the enter key.
 
Upvote 0
Hi,
well when I enter this code in the approbiate Worksheet and I have data in Column "A" it will always show me the last Row in column A..
Is that not what you like to do?
So you have to go into the worksheet Events and use Worksheet Change event or experiment with the other events which might do what you are after.

Chees
 
Upvote 0
Hi,
well when I enter this code in the approbiate Worksheet and I have data in Column "A" it will always show me the last Row in column A..
Is that not what you like to do?
So you have to go into the worksheet Events and use Worksheet Change event or experiment with the other events which might do what you are after.

Chees

Hello,

The code worked perfectly , thank you. Although at the end i had to use a lookup formula to show up the data of a non-empty cell.
 
Upvote 0

Forum statistics

Threads
1,215,040
Messages
6,122,806
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top