I am having type mismatch error while the code below. Can someone
help me on this?
Sub iterate()
Dim shtFrom, shtTo, shtStart As Worksheet
Set shtStart = Sheets("Class Template")
Dim shtName1, shtName2 As String
Dim iterNum
iterNum = shtStart.Cells(7, 1).Value
MsgBox "Iteration" & iterNum
shtName1 = "Iterate" & iterNum
shtName2 = "Iterate" & iterNum - 1
If iterNum = 1 Then
Set shtFrom = Sheets("Original")
Else
Set shtFrom = Sheets(shtName2)
End If
'***###*** code BELOW is to set initial values for i and j column
Call populateIJ(5, 1, shtFrom)'###***### I am getting compilation
error here
'****there are other code here too. But it is not relevant to
'the problem I am facing
End Sub
Sub populateIJ(x As Integer, y As Integer, z As Worksheet)
Dim rowIJ
Dim shtFrom As Worksheet
Set shtFrom = Sheets(z)
rowIJ = 34 'column J =12 column I=13
Do While rowIJ < 39
If shtFrom.Cells(rowIJ, 21) = x Then
shtFrom.Cells(rowIJ, 12) = 1
Else
shtFrom.Cells(rowIJ, 12) = 0
End If
If shtFrom.Cells(rowIJ, 21) = y Then
shtFrom.Cells(rowIJ, 13) = -1
Else
shtFrom.Cells(rowIJ, 13) = 0
End If
rowIJ = rowIJ + 1
Loop
End Sub