How do I start a program to print a Floyd's triangle in Excel based on the user's input for the number of rows to be displayed using Visual Basic??
VBA FLOYDS TRIANGLEFLOYD'S Triangle in VBA programming
Page 1 of 1
5 Replies - 2364 Views - Last Post: 27 October 2010 - 03:07 PM
Replies To: VBA FLOYDS TRIANGLE
#2
Re: VBA FLOYDS TRIANGLE
Posted 27 October 2010 - 02:07 PM
press alt+f11 and declare some variables.
#3 Guest_audrika9*
Re: VBA FLOYDS TRIANGLE
Posted 27 October 2010 - 02:19 PM
#4
Re: VBA FLOYDS TRIANGLE
Posted 27 October 2010 - 02:45 PM
Start by learning the language. Online tutorials are excellent resources.
#5 Guest_audrika9*
Re: VBA FLOYDS TRIANGLE
Posted 27 October 2010 - 03:06 PM
this is my program for it:
Sub FLOYD()
'define variables
Dim n As Single 'number in floyd triangle
Dim a As Integer 'rows
Dim b As Integer 'columns
Dim iprow As Single 'rows input
'input
iprow = InputBox("enter an number,n, for the number of rows")
'data echo
Sheet4.Cells(4, 2).Value = iprow
For a = 1 To iprow 'counter loop for the rows
For b = 1 To a 'counter loop for the columns
n = n + 1
Sheet4.Cells(4 + a, 2 + B)/>.Value = n 'output of floyd triangle
Next b
Next a
End Sub
This post has been edited by macosxnerd101: 27 October 2010 - 03:18 PM
Reason for edit:: Added code tags. Please use them in the future.
#6 Guest_audrika9*
Re: VBA FLOYDS TRIANGLE
Posted 27 October 2010 - 03:07 PM
and that smile face was suppose to be b )
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote










|