Need excel expert

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try like this

Code:
Sub Stars()
Dim i As Long
For i = 1 To 4
    Cells(i, 1).Resize(, i).Value = "*"
Next i
End Sub
 

UniMord

Active Member
Joined
May 6, 2002
Messages
311
If you want all your asterisks in a single column, enter in row 1: =REPT("*", ROW()) and drag down.

If you want your asterisks in separate columns, enter in A1: =IF(COLUMN()<= ROW(), "*", "") and drag as far down and right as you like.
 
Last edited:

UniMord

Active Member
Joined
May 6, 2002
Messages
311
Only if you need all your asterisks in a single cell, will you be forced to use VBA. To extend VoG's solution above, you can use the following function:

Code:
Function Stars(num&) As String
    Dim i&
 
    For i = 1 To num
        Stars = Stars & String(i, "*") & vbNewLine
    Next i
    Stars = Left(Stars, Len(Stars) - Len(vbNewLine))
End Function

Just make sure that you have wrap text on, otherwise you'll just get them all in a row.
 

kashif.special2005

Active Member
Joined
Oct 26, 2009
Messages
439

ADVERTISEMENT

Thanks for reply

I want to do this through procedure

I want to create prymide

like Capital A sign

kashif
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,205
To create a pyramid (all in one column), create a right triangle (like UniMord's formula) and then format the cells to align Center.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,205
If you have
A1 = "*"
A2 = "**"
A3 = "***"
A4 = "****"

it will look like a right triangle if A1:A4 are set to align Left (the default) but will look like an isosceles triangle if they are set to align center.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,598
Messages
5,832,646
Members
430,150
Latest member
amitk1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top