I keep getting type mismatch errors here, and I'm not sure why...
Sub GetYields(ByVal g As Long)
Workbooks.Open ("S:\H062\seg130\GIC\GetRatesTesterFile.xls")
Workbooks("hard work tester file.xls").Worksheets("Sheet2").Activate
If g > 8 Then
For y = 2 To g - 2
Cells(g + y - 1, 11).Value = Switch(y = 2, 1, y = 3, 2, y = 4, 3, y = 5, 4, y = 6, 5, y = 7, 10)
Cells(g + y - 1, 12).Value = AutoAssign(ByVal y)
Next y
Else
For k = 1 To 6
Cells(g + k, 11).Value = Switch(k = 1, 1, k = 2, 2, k = 3, 3, k = 4, 4, k = 5, 5, k = 6, 10)
Cells(g + k, 12).Value = AutoAssign(k + 1)
Next k
End If
End Sub
g is declared as a long for no good reason, but I left it that way. It's sent to this function ByVal. AutoAssign is a function that returns a long-type number from the Test.xls workbook. I don't understand why I'm getting an error at the first call of AutoAssign. It's telling me there's a type mismatch with y, in the function call.
Any suggestions?
Bookmarks