Macro Autofilling A Series With Number Increasing

sperryruss

New Member
Joined
May 6, 2011
Messages
2
I do not know vba programming but I know what the editor is and can copy code into it. I have only been using excel 2000 about a week.

I need to autofill with a number that will be different each time. I need that number to increase by one in a series to the right ranging from column B to V (like entering 171 and having it go across autofilling ending up with number 191.
I have searched internet extensively and the closest thing I have found is:

Sub ExtendDates()

Selection.AutoFill Destination:=ActiveCell.Range("A1:V1"), Type:= _
xlFillDefault

End Sub

I am not dealing with dates just numbers but this example had dates in it.

If I enter in a number in Column B this code will copy it across to Column V. But I need it to increase one number in each column for 21 columns. I need a macro like this because I have to do this around 400 times.

From what I have learned so far I think I need it to be relative because even though the columns are the same across (B to V) the row will change with a new number added each time.

Thanks,
Sperry
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try

Code:
Sub ExtendNumbers()
With ActiveCell
    .AutoFill Destination:=.Resize(, 21), Type:=xlFillSeries
End With
End Sub
 
Upvote 0
Hi Sperry
Welcome to the board

Also:

Code:
Sub Extend()
    
    Range("B1").Value = 171
    Range("B1:V1").DataSeries
End Sub
 
Upvote 0
Peter,

This is exactly what I needed. It works very good. Thanks for taking the time to respond. I only started to learn Excel during the past week to help a business friend of mine who does not know a lot about computers. I have been working with many programs and computers for a while but never had a need for Excel. After seeing how it works I can see it will be useful for me in the future.

PGC,

Thank you too for your help and response. Your macro works but I needed it to change every time because I had to enter a different number over 400 times So Peter's took it a step further.

Thanks Again,
Sperry
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

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