Link to home
Start Free TrialLog in
Avatar of SunnyX
SunnyX

asked on

make number series in excel visual basic

I need excel visual basic macros that would make for me series of numbers that looks like



4.5,      5, 5.5, 6, 6.5, 7, 7.5 , 8, 8.5, 9, 9.5 ...  in single sell

the comma is obligatory

So I simple button "start " ; input cells and output cell
In attachment you can find an example of sheet design
numbers.xlsx
SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oops. No it won't. The first number has been omitted.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
But easily fixed:
Sub MakeNumbersString()
    Dim s As Single
    Dim strNumbers As String
    
    s = Cells(3, 3).Value
    strNumbers = s & ", "
    Do Until s >= Cells(5, 3)
        s = s + 0.5
        strNumbers = strNumbers & s & ", "
    Loop
    strNumbers = Left(strNumbers, Len(strNumbers) - 2)
    Cells(8, 8) = strNumbers
End Sub

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Professor J
Professor J

Rory :-D