Need excel expert

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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
 
Upvote 0
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:
Upvote 0
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.
 
Upvote 0
To create a pyramid (all in one column), create a right triangle (like UniMord's formula) and then format the cells to align Center.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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
Back
Top