cmoore1
asked on
excel macro
I'm looking for a macro to fill a column with incrementing numbers. starting it with the value of the current cell then moving down the spread sheet incrementing the the by 1 with each move until i reach a predetermined number.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I must need more than this, I get a compiler erro "expected:named parameter" with tpye highlighted
That error would occur if the command in line 5 of my code was split up to two lines like so:
If you need to format your code like that, add an underscore at the end of the first line so that the compiler will continue reading to the next line, as here:
If this still doesn't resolve your issue, let us know.
-Glenn
ActiveCell.DataSeries Rowcol:=xlColumns,
Type:=xlLinear, Step:=1, Stop:=intFinal
If you need to format your code like that, add an underscore at the end of the first line so that the compiler will continue reading to the next line, as here:
ActiveCell.DataSeries Rowcol:=xlColumns, _
Type:=xlLinear, Step:=1, Stop:=intFinal
If this still doesn't resolve your issue, let us know.
-Glenn
Here is alternate code if that doesn't work.
Sub Increment()
Dim x, intFinal As Integer
intFinal = Application.InputBox("Enter Final Value:", , , , , , , 1)
If intFinal > ActiveCell.Value Then
For x = ActiveCell.Value + 1 To intFinal
ActiveCell.Offset(x - ActiveCell.Value, 0).Value = x
Next x
End If
End Sub
ASKER
Glen
running this galso gives me an error user-defined type not defined.
Highlighting " intFinal As Integer"
running this galso gives me an error user-defined type not defined.
Highlighting " intFinal As Integer"
ASKER
Glen
running this alternate code also gives me an error user-defined type not defined.
Highlighting " intFinal As Integer"
running this alternate code also gives me an error user-defined type not defined.
Highlighting " intFinal As Integer"
You probably need to Repair or re-install Excel then. These definitions are part of the Excel object library reference and shouldn't give you any errors whatsoever. I can't think of any other reason why this wouldn't work.
-Glenn
-Glenn
ASKER
Thanks,
I will try it. I'm out of town currently. I'll try this when I get back.
Thanks again.
Charlie
I will try it. I'm out of town currently. I'll try this when I get back.
Thanks again.
Charlie
Open in new window