Dear Group,
Please find attached sheet, it is very usefull to understand Loop in VBA
Thanks & regards,
Noorain Ansari
*http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/>
*http://noorain-ansari.blogspot.com/* <http://noorain-ansari.blogspot.com/>
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel
*
****
******
********
**********
Sub test()
Dim i, k, j As Integer, str As String
j = InputBox("Please enter the Number of Stars")
str = "*"
ActiveCell.Select
For i = 0 To j
For k = 0 To i
ActiveCell.Offset(i, -k).Value = str
ActiveCell.Offset(i, k).Value = str
Next
Next
End Sub
---------------------------------------------------------------
***********
********
****
**
*
Sub test()
Dim i, k, j As Integer, str As String
j = InputBox("Please enter the Number of Stars")
str = "*"
For i = 0 To j
For k = 0 To j
ActiveCell.Offset(i, -k).Value = str
ActiveCell.Offset(i, k).Value = str
Next
j = j - 1
Next
End Sub
-----------------------------------------------------------------
*
**
***
*****
******
********
Sub test()
Dim i, k, j As Integer, str As String
j = InputBox("Please enter the Number of Stars")
str = "*"
For i = 0 To j
For k = 0 To i
ActiveCell.Offset(i, k).Value = str
Next
Next
End Sub
-----------------------------------------------------------------
*
**
***
****
*****
******
Sub test()
Dim i, k, j As Integer, str As String
j = InputBox("Please enter the Number of Stars")
str = "*"
For i = 0 To j
For k = 0 To i
ActiveCell.Offset(i, -k).Value = str
Next
Next
End Sub
------------------------------------------------------------------
*********
********
******
****
**
*
Sub test()
Dim i, k, j As Integer, str As String
j = InputBox("Please enter the Number of Stars")
str = "*"
For i = 0 To j
For k = 0 To j
ActiveCell.Offset(i, k).Value = str
Next
j = j - 1
Next
End Sub
--------------------------------------------------------------------
*********
*******
*****
****
***
*
Sub test()
Dim i, k, j As Integer, str As String
j = InputBox("Please enter the Number of Stars")
str = "*"
For i = 0 To j
For k = 0 To j
ActiveCell.Offset(i, -k).Value = str
Next
j = j - 1
Next
End Sub