I have a method called "checkConvert" which is supposed to return a String.
I have created a For Loop which at the end of the loop returns a value as checkConvert. Also, inside that For Loop, I have setup a Case and inside that Case, another For loop with If Statements inside. Inside those If Statements, I have also tried to return a value as checkConvert, however it does NOT work at all.
For i = val To lastColumn_source
For j = 1 To 3
Dim cellValue As String
cellValue = salesSource.Cells(j, i).Value
Select Case i
Case 1
Dim match As Boolean
match = False 'Default is false.
'Equating two cells = false.
For x = 1 To lastRow_check
If cellValue = sourceCheck.Cells(x, 1) Then
CRMDest.Cells(j, 2) = newName
match = True 'Match is found. Thus, true.
End If
If x = lastRow_check And match = False Then
checkConvert = newName 'Supposed to return
'value. Doesn't
'work.
MsgBox checkConvert 'But MsgBox works.
End If
Next x
Case 2 'Several more cases follow.
Case 13
checkConvert = "End of Program." 'Returns String
'to "end program."
'This one works.
End Select
checkConvert = "Move." 'This return also
'works.
Next j
Next i