AW: Excel VBA nach bestimmter Zeit scrollen
28.12.2018 08:47:24
Sepp
Hallo Anna,
das geht z.B. so:
Microsoft Excel Objekt DieseArbeitsmappe
Option Explicit
Private Sub Workbook_Activate()
Call startTimer
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call startTimer
End Sub
Private Sub Workbook_Deactivate()
Call stopTimer
End Sub
Private Sub Workbook_Open()
Call stopTimer
End Sub
VBA/HTML-CodeConverter, AddIn für Office 2002-2016 - in VBA geschrieben von Lukas Mosimann. Projektbetreuung:RMH Software & Media
Code erstellt und getestet in Office 16 - mit VBAHTML 12.6.0
Modul Modul1
Option Explicit
Private Const cstrProcedure As String = "scrollWindow"
Private Const clngIntervall As Long = 60 'Intervall in Sekunden
Private nextTime As Double
Sub scrollWindow()
Dim lngLast As Long, lngRow As Long
With ActiveSheet
lngLast = .Cells(.Rows.Count, 1).End(xlUp).Row
End With
With ActiveWindow
lngRow = .ScrollRow + 18
If lngRow > lngLast Then lngRow = 1
.ScrollRow = lngRow
End With
Call startTimer
End Sub
Sub startTimer()
nextTime = Now + TimeSerial(0, 0, clngIntervall)
Call Application.OnTime(nextTime, cstrProcedure, Schedule:=True)
End Sub
Sub stopTimer()
On Error Resume Next
Call Application.OnTime(nextTime, cstrProcedure, Schedule:=False)
End Sub
VBA/HTML-CodeConverter, AddIn für Office 2002-2016 - in VBA geschrieben von Lukas Mosimann. Projektbetreuung:RMH Software & Media
Code erstellt und getestet in Office 16 - mit VBAHTML 12.6.0