scroll automatically as data is imported into a spreadsheet

L

Light Meter Reader

Hi - is there a way to get Excel to scroll a speadsheet automatically as data
is being imported into it from an external source? I have a lightmeter that
takes readings and sends them to a spreadsheet through external sofware via
RS232. Readings are taken every 0.5 second and being entered into
consecutive cells on a spreadsheet - I want the spreadsheet to scroll
automatically as the data is being transferred. Can this be done? How? I am
using Excel 2003. thanks.
 
J

JLatham

You don't say if the readings are being put into rows or are added into a
column going on down the sheet. I'm assuming that they are going into a
single column (or at least if a series is coming in, something is always
added in one particular column).

The code below may work for you. It is worksheet event code and needs to go
into the module for the worksheet that receives the data. To put it in the
right place, choose that worksheet then Right-click on its name tab and
choose [View Code] from the popup list. Copy the code below and paste it
into the module. Change the constant that is set to = "A" to whatever column
the data comes into. It should work after that change is made. As data
comes into that column, it will scroll up to be at the top of the window.
Hope this helps at least a little.

Private Sub Worksheet_Change(ByVal Target As Range)
Const ColumnDataComesInto = "A" ' change as needed
Dim lastRow As Long
Static lastEntryRow As Long

lastRow = Range(ColumnDataComesInto & Rows.Count).End(xlUp).Row
If lastRow > lastEntryRow Then
lastEntryRow = lastRow
Application.Goto _
reference:=Range(ColumnDataComesInto & lastEntryRow), _
scroll:=True
End If
End Sub
 

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