0

I hope this is the correct forum

I am converting some qbasic to vba and have come undone. The qbasic lines -

FOR I = 1 TO A
IF B(I) > 0 THEN
PRINT "("; C(I); "="; D(I); ")";
END IF
NEXT I
screen prints the values for SLENGTH and besteachtype on the same row. There may be up to five entries on the row such as -

( 1749 = 1 )( 1542 = 1 )( 717 = 1)( 1774 = 1 )

The VBA lines I have so far are -

For I = 1 To A
If B(I) > 0 Then
result = C(I) & " = " & D(I)
End If
Next I

where "result" is defined as a string. The intention is to insret "result" into a spreadsheet. However only the last values 1774 = 1 are entered so I assume the others are being overwritten. I also assume that this has something to do with the semi-colons but I can't find an equivalent in VBA. Any suggestions?

Thanks
Peter

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by palpha
0

Thanks waynespansler

The line above gives me a compile error: expected expression. I think I will have to use another counter for when B(I) = 0. It seems messy but ...

Thanks again, Peter

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.