VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Iterator_sample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public row_ As Long
Private data_ As Excel.Worksheet

Public Sub Init(target As Excel.Worksheet, Optional tRow& = FIRST_ROW)
  Set data_ = target
  row_ = tRow
End Sub

Public Function Increment(Optional inc& = 1)
  If row_ + inc > 0 Then _
    row_ = row_ + inc
End Function

Public Function GoFirst()
  row_ = FIRST_ROW
End Function

Public Function GoLast()
  row_ = data_.Columns(S_E_ID).Find(vbNullString, LookAt:=xlWhole).Row - 1
End Function

Public Function IsDone() As Boolean
  IsDone = data_.Cells(row_, S_E_ID) = vbNullString
End Function

Public Function RemoveRow()
  Call data_.Rows(row_).Delete
End Function

'===== Propertiy Get =====
Public Property Get WorkerID() As String
  WorkerID = data_.Cells(row_, S_E_ID)
End Property

Public Property Get WorkerName() As String
  WorkerName = data_.Cells(row_, S_E_NAME)
End Property

Public Property Get Active() As Boolean
  Active = data_.Cells(row_, S_E_ACTIVE) = 1
End Property

Public Property Get Hours() As Double
  Hours = data_.Cells(row_, S_E_HOURS)
End Property

Public Property Get ReportPath() As String
  ReportPath = data_.Cells(row_, S_E_PATH)
End Property

' ==== Property Let ====
Public Property Let WorkerID(newVal$)
  data_.Cells(row_, S_E_ID) = newVal
End Property

Public Property Let WorkerName(newVal$)
  data_.Cells(row_, S_E_NAME) = newVal
End Property

Public Property Let Active(newVal As Boolean)
  data_.Cells(row_, S_E_ACTIVE) = IIf(newVal, 1, 0)
End Property

Public Property Let Hours(newVal As Double)
  data_.Cells(row_, S_E_HOURS) = newVal
End Property

Public Property Let ReportPath(newVal$)
  data_.Cells(row_, S_E_PATH) = newVal
End Property
