Visual Basic for Applications?
Ok, please assistance me explain and understand this code BY LINE:
Subscription triangle()
Regarding x = 1 To 10
Regarding y = by To 10
Cells(x, y) = “HI”
Upcoming y
Upcoming x
Ending Sub
The outcome on Excel is definitely an inverted triangle composed of “HI”.Remember to explain bless you!!
Sub triangle()
This brand declares your Subroutine when using the name triangle
Regarding x = 1 To 10
This range sets in place an outside loop which starts when using the value connected with x = 1 and increments it through 1 when through until eventually x = 10
Regarding y = by To 10
This range sets up an inside loop that starts when using the value connected with y = existing value connected with x in addition to increments this by 1 everytime through until eventually y = 10
Cells(x, y) = “HI”
This range sets the value of that cell on x, y for the string “HI”
Upcoming y
This range signals this course to increment the worthiness of b by 1
Upcoming x
This range signals this course to increment the worthiness of back button by 1
Ending Sub
This range specifies the completed of the actual subroutine
This subroutine purposes nesting For-Next loops align a selection of values.Around the first taste the exterior loop, times = ONE PARTICULAR, and your inner picture sets y from YOU to 12.This could set tissue 1, 10, 21, 3…1, 10
Around the next taste the exterior loop, x=2 as well as inner trap sets ful from A COUPLE OF to TEN.This could set tissue 2, 22, 32, 5…2, 10
Our next pass models cells 3, 33, 5…3, 10 and so forth, until the past cell 15, 10 is placed and the actual subroutine closes.
Leave a Reply
You must be logged in to post a comment.