Convert qbasic code to vba

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 2
Reputation: palpha is an unknown quantity at this point 
Solved Threads: 0
palpha palpha is offline Offline
Newbie Poster

Convert qbasic code to vba

 
0
  #1
Jul 2nd, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: Convert qbasic code to vba

 
0
  #2
Jul 3rd, 2008
try:
result &= C(I) & " = " & D(I)
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2
Reputation: palpha is an unknown quantity at this point 
Solved Threads: 0
palpha palpha is offline Offline
Newbie Poster

Re: Convert qbasic code to vba

 
0
  #3
Jul 3rd, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC