S
Sally Mae
I have macro that contains among other thing o for loop. I now get error next
without for. I cannot see what the problem is. My code:
For l = 1 To i - 1
If rng6.Offset(l, 0) <> 0 Then
If rng4.Offset(l, 0) = 0 Then
Range(rng1.Offset(l, k + 3).Address) = rng3.Offset(l, 0)
* Range(rng1.Offset(l, k + 1).Address)
Else: Range(rng1.Offset(l, k + 3).Address) = rng4.Offset(l,
0) * Range(rng1.Offset(l, k + 1).Address)
End If
Else: Range(rng1.Offset(l, k + 3).Address) = rng3.Offset(l, 0) *
Range(rng1.Offset(l, k + 1).Address)
End If
dblSummaSecurityContributionToBench =
dblSummaSecurityContributionToBench + Range(rng1.Offset(l, k + 3).Address)
'kollar om det finns skillnad i local return mellan bench och portfölj
If rng4.Offset(l, 0) <> 0 And rng3.Offset(l, 0) <> 0 And rng4.Offset(l,
0) <> rng3.Offset(l, 0) Then
dblLocalReturnDiff = rng4.Offset(l, 0) - rng3.Offset(l, 0)
If Abs(dblLocalReutrnDiff) > dblErrorMarginal Then
Err.Raise 600
Else: End If
Next
as you can see there are several if´s in the for-loop, but that has never
been a problem before. Please help me if you know what is wrong! Thank you!
without for. I cannot see what the problem is. My code:
For l = 1 To i - 1
If rng6.Offset(l, 0) <> 0 Then
If rng4.Offset(l, 0) = 0 Then
Range(rng1.Offset(l, k + 3).Address) = rng3.Offset(l, 0)
* Range(rng1.Offset(l, k + 1).Address)
Else: Range(rng1.Offset(l, k + 3).Address) = rng4.Offset(l,
0) * Range(rng1.Offset(l, k + 1).Address)
End If
Else: Range(rng1.Offset(l, k + 3).Address) = rng3.Offset(l, 0) *
Range(rng1.Offset(l, k + 1).Address)
End If
dblSummaSecurityContributionToBench =
dblSummaSecurityContributionToBench + Range(rng1.Offset(l, k + 3).Address)
'kollar om det finns skillnad i local return mellan bench och portfölj
If rng4.Offset(l, 0) <> 0 And rng3.Offset(l, 0) <> 0 And rng4.Offset(l,
0) <> rng3.Offset(l, 0) Then
dblLocalReturnDiff = rng4.Offset(l, 0) - rng3.Offset(l, 0)
If Abs(dblLocalReutrnDiff) > dblErrorMarginal Then
Err.Raise 600
Else: End If
Next
as you can see there are several if´s in the for-loop, but that has never
been a problem before. Please help me if you know what is wrong! Thank you!