Author | Topic: Autofill for Excel | |
---|---|---|
César Calvo | Autofill for Excel on Mon, 31 Dec 2018 19:22:46 +0100 Hello. I need do Autofill with ActiveX When I make the macro is: Selection.AutoFill Destination:=Range ("H2:H1932") How would be it for Alaska XBase? Thanks. César. | |
Jonathan Leeming | Re: Autofill for Excel on Tue, 01 Jan 2019 09:16:57 -0700 On 12/31/2018 11:22 AM, César Calvo wrote: > Hello. > > I need do Autofill with ActiveX > > When I make the macro is: > > Selection.AutoFill Destination:=Range ("H2:H1932") > > How would be it for Alaska XBase? > > Thanks. > César. Hi Cesar, In my example I am setting A1 & A2 to 1 and 2 respectively and then using autofill to replace the values in A3 -> A20 with default autofill values 3,4,5... oXls := CreateObject("Excel.Application") oBook := oXls:workbooks:Add() Open new blank Excel Workbook oSheet := oBook:ActiveSheet oRange := oSheet:Range("A1:A2") oRange:value := {{1},{2}} oDestination := oSheet:Range("A1:A20") oRange:AutoFill(oDestination) After oDestination in the Autofill line you can optionally include the Autofill Type: https://docs.microsoft.com/en-us/office/vba/api/excel.xlautofilltype oRange:AutoFill(oDestination,xlFillDefault) Hope this helps... Happy New year!!! Regards... Jonathan jonathan.leeming@the-family-centre.com Edmonton, Alberta, Canada | |
César Calvo | Re: Autofill for Excel on Tue, 01 Jan 2019 21:54:08 +0100 Of course dear Jonathan, like your model I have got it: oExcel:Columns("B:B"):Select oExcel:Selection:Insert(xlToRight,xlFormatFromLeftOrAbove) oExcel:Range("B2"):Select oExcel:ActiveCell:Formula = '="" & A2' oExcel:Range("B2"):Select oDes := oExcel:Range("B2:B425") oExcel:Range("B2:B425") oExcel:Selection:AutoFill(oDes) Thanks and Best. César. "Jonathan Leeming" escribió en el mensaje de noticias:44c57599$a5ec77c$8af04@news.alaska-software.com... On 12/31/2018 11:22 AM, César Calvo wrote: > Hello. > > I need do Autofill with ActiveX > > When I make the macro is: > > Selection.AutoFill Destination:=Range ("H2:H1932") > > How would be it for Alaska XBase? > > Thanks. > César. Hi Cesar, In my example I am setting A1 & A2 to 1 and 2 respectively and then using autofill to replace the values in A3 -> A20 with default autofill values 3,4,5... oXls := CreateObject("Excel.Application") oBook := oXls:workbooks:Add() Open new blank Excel Workbook oSheet := oBook:ActiveSheet oRange := oSheet:Range("A1:A2") oRange:value := {{1},{2}} oDestination := oSheet:Range("A1:A20") oRange:AutoFill(oDestination) After oDestination in the Autofill line you can optionally include the Autofill Type: https://docs.microsoft.com/en-us/office/vba/api/excel.xlautofilltype oRange:AutoFill(oDestination,xlFillDefault) Hope this helps... Happy New year!!! Regards... Jonathan jonathan.leeming@the-family-centre.com Edmonton, Alberta, Canada |