Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
I am getting a 'type mismatch error' with the red highlighted line in my code below.
The data in worksheet ws_master, column e are times. I am trying to assign variable st to the decimal value of the true time that is in the cell (srow,5).
Rich (BB code):
Sub pda_assign1()
Dim srow As Integer
Dim pnum As String
Dim fac2 As String
Dim nrec As Double
Dim st As Date
With ws_thold
'master static staff list
.Range("A:E").ClearContents
'A - Shift; B - Name; C - Crew; D - time on; E - time off
drow = 1
For I = 12 To 33 'source
If ws_master.Cells(I, 22) <> "" Then
.Cells(drow, 1) = ws_master.Cells(I, 19) 'shift (s)
.Cells(drow, 2) = ws_master.Cells(I, 23) 'name (w)
.Cells(drow, 3) = ws_master.Cells(I, 22) 'crew (v)
.Cells(drow, 4) = ws_master.Cells(I, 20) 'time on (d)
.Cells(drow, 5) = ws_master.Cells(I, 21) 'time off (e)
drow = drow + 1
End If
Next I
End With
With ws_master
nrec = Application.WorksheetFunction.CountA(.Range("C12:C37"))
If nrec = 0 Then
MsgBox "No rentals to assign."
'proceed to services assignments
Stop
Exit Sub
End If
For srow = 13 To 13 + nrec
btype = .Cells(srow, 2)
pnum = .Cells(srow, 3)
fac2 = .Cells(srow, 4) 'LABEL (col6) in core_data
st = .Cells(srow, 5).Value
Stop
If btype Like "F*" Then
signatures srow, pnum, fac2, nrec, st
ElseIf btype Like "D*" Then
ElseIf btype Like "C*" Then
ElseIf btype Like "G*" Then
ElseIf btype Like "T*" Then
ElseIf btype Like "S*" Then
Else
MsgBox "Error: pda_assign1"
Stop
End If
Next srow
End With
End Sub
The data in worksheet ws_master, column e are times. I am trying to assign variable st to the decimal value of the true time that is in the cell (srow,5).