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

try:
result &= C(I) & " = " & D(I)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.