View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Oskar von dem Hagen[_2_] Oskar von dem Hagen[_2_] is offline
external usenet poster
 
Posts: 5
Default time/timing/breakpoint

The whole code is a bit messy. (I hope the excerpt, see below, contains all
relevant information.). It's basically an applied example from Bullen et al.
modified to have formulas as database entries and using a class module to
catch PgDn/PgUp keys.

If I use step mode, the cell remains populated.

Oskar von dem Hagen

P.S. (Longer) Code excerpt:
Private Sub UserForm_Initialize()
Dim temp As Integer
[...]
'Load 1st record in Datenbank and initialise scrollbar
With Range("Datenbank")
temp = ActiveCell.Row - 12
sbNavigator.Max = .Rows.Count
If Not (temp 2) Then
sbNavigator.Value = 2
Set rgData = .Rows(sbNavigator.Value)
Call LoadRecord
ElseIf Not (temp <= sbNavigator.Max) Then
sbNavigator.Value = sbNavigator.Max
Else
sbNavigator.Value = temp
End If
End With
[...]
End Sub

Private Sub LoadRecord()
[...]
tbtime.ControlSource = rgData.Cells(1, 49).Address()
End Sub

Private Sub sbNavigator_Change()
'When Scrollbar value changes, save current record and load
'record number corresponding to scrollbar value
Set rgData = Range("Datenbank").Rows(sbNavigator.Value)
[D12].Value = sbNavigator.Value
Call LoadRecord
End Sub

Public Sub bnNext_Click()
With Range("Datenbank")
If rgData.Row < .Rows(.Rows.Count).Row Then
'Load next record only if not on last record
sbNavigator.Value = sbNavigator.Value + 1
'Note: Setting sbNavigator.Value runs its Change event procedure
End If
End With
End Sub

Private Sub cbtime_Click()
tbtime.Value = Time
Call bnNext_Click
End Sub