ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Selection AutoFill, Excel 2000 & 2003 (https://www.excelbanter.com/excel-worksheet-functions/128041-selection-autofill-excel-2000-2003-a.html)

James Cooper

Selection AutoFill, Excel 2000 & 2003
 
Hello,

I have multiple worksheets that I need to add numbers to cells incrementing
them by 1 to multiple columns but I was wondering how you can get the
Selection.AutoFill to begin with 21 in A1 and stop at 3500. This is the code
i've got so far but you have to manually put the destination cell in I would
like to automatically stop?

Range("A1").Select
ActiveCell.FormulaR1C1 = "31"
Range("A2").Select
ActiveCell.FormulaR1C1 = "32"
Range("A1:A2").Select
Selection.AutoFill Destination:=Range("A:A"), Type:=xlFillDefault

Thank you for your help,
jfcby




FSt1

Selection AutoFill, Excel 2000 & 2003
 
hi,
Try this code....

Range("A1").FormulaR1C1 = "31"
Range("A2").FormulaR1C1 = "32"
Range("A3").FormulaR1C1 = "33"
Range("A1:A3500").Select 'Selects the range
Selection.DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Step:=1, _
Stop:=3500 'Where to stop

Regards
FSt1


"James Cooper" wrote:

Hello,

I have multiple worksheets that I need to add numbers to cells incrementing
them by 1 to multiple columns but I was wondering how you can get the
Selection.AutoFill to begin with 21 in A1 and stop at 3500. This is the code
i've got so far but you have to manually put the destination cell in I would
like to automatically stop?

Range("A1").Select
ActiveCell.FormulaR1C1 = "31"
Range("A2").Select
ActiveCell.FormulaR1C1 = "32"
Range("A1:A2").Select
Selection.AutoFill Destination:=Range("A:A"), Type:=xlFillDefault

Thank you for your help,
jfcby






All times are GMT +1. The time now is 04:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com