![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Auto-filling VB Script Code for Excel The following Excel macro will auto-fill the cells G1:G6 based on the contents of the cells G1:G2: Range("G1:G2").Select Range("G2").Activate Selection.AutoFill Destination: = Range("G1:G6"), Type: = xlFillDefault I need to perform the same operation with a pure VB Script. Is it possible? If yes, how? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Auto-filling VB Script Code for Excel Option Explicit Const xlFillDefault = 0 Dim filePath, oExcel, oSheet filePath = "c:\Test.xls" Set oExcel = CreateObject("Excel.Application") oExcel.Workbooks.Open(filepath) Set oSheet = oExcel.ActiveWorkbook.Worksheets(1) osheet.Range("G1:G2").Select osheet.Range("G2").Activate oExcel.Selection.AutoFill oExcel.Range("G1:G6"), xlFillDefault oExcel.ActiveWorkbook.Save oExcel.ActiveWorkbook.Close set oSheet = Nothing Set oExcel = Nothing -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Pegasus (MVP)" wrote: Quote: > The following Excel macro will auto-fill the cells G1:G6 based on the > contents of the cells G1:G2: > Range("G1:G2").Select > Range("G2").Activate > Selection.AutoFill Destination: = Range("G1:G6"), Type: = xlFillDefault > > I need to perform the same operation with a pure VB Script. Is it > possible? If yes, how? > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Auto-filling VB Script Code for Excel "Dave Patrick" <DSPatrick@xxxxxx> wrote in message news:erqdTMlCJHA.4700@xxxxxx Quote: > Option Explicit > Const xlFillDefault = 0 > Dim filePath, oExcel, oSheet > > filePath = "c:\Test.xls" > Set oExcel = CreateObject("Excel.Application") > oExcel.Workbooks.Open(filepath) > Set oSheet = oExcel.ActiveWorkbook.Worksheets(1) > osheet.Range("G1:G2").Select > osheet.Range("G2").Activate > oExcel.Selection.AutoFill oExcel.Range("G1:G6"), xlFillDefault > oExcel.ActiveWorkbook.Save > oExcel.ActiveWorkbook.Close > set oSheet = Nothing > Set oExcel = Nothing > > -- > > Regards, > > Dave Patrick ....Please no email replies - reply in newsgroup. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Auto Filling Addresses | Vista mail | |||
| start word, excel from script | VB Script | |||
| Re: How to do something in an VBS script for all worksheets of an Excel file? | VB Script | |||
| Auto filling in of email addresses ? | Vista mail | |||
| Auto filling email recipient address | Vista mail | |||