VBA FLOYDS TRIANGLE

FLOYD'S Triangle in VBA programming

Page 1 of 1

5 Replies - 4172 Views - Last Post: 27 October 2010 - 03:07 PM Rate Topic: -----

#1 Guest_audrika9*


Reputation:

VBA FLOYDS TRIANGLE

Posted 27 October 2010 - 01:55 PM

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??
Is This A Good Question/Topic? 0

Replies To: VBA FLOYDS TRIANGLE

#2 earlgrey  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 91
  • Joined: 26-September 10

Re: VBA FLOYDS TRIANGLE

Posted 27 October 2010 - 02:07 PM

press alt+f11 and declare some variables.
Was This Post Helpful? 0
  • +
  • -

#3 Guest_audrika9*


Reputation:

Re: VBA FLOYDS TRIANGLE

Posted 27 October 2010 - 02:19 PM

View Postearlgrey, on 27 October 2010 - 01:07 PM, said:

press alt+f11 and declare some variables.


that's not using VBA
Was This Post Helpful? 0

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10560
  • View blog
  • Posts: 39,071
  • Joined: 27-December 08

Re: VBA FLOYDS TRIANGLE

Posted 27 October 2010 - 02:45 PM

Start by learning the language. Online tutorials are excellent resources.
Was This Post Helpful? 0
  • +
  • -

#5 Guest_audrika9*


Reputation:

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.

Was This Post Helpful? 0

#6 Guest_audrika9*


Reputation:

Re: VBA FLOYDS TRIANGLE

Posted 27 October 2010 - 03:07 PM

and that smile face was suppose to be b )
Was This Post Helpful? 0

Page 1 of 1