#### Topic: Record from vfp9 a macro

Please, help to translate this macro in vfp9

Selection. AutoFill Destination: = Range ("B1066:BY1066"), Type: = xlFillDefault

Range ("B1066:BY1066").Select

You are not logged in. Please login or register.

Please, help to translate this macro in vfp9

Selection. AutoFill Destination: = Range ("B1066:BY1066"), Type: = xlFillDefault

Range ("B1066:BY1066").Select

mv123321;

```
LOCAL ii, jj, loExcel, lcPath, loWorkBook, loSheet
loExcel = CREATEOBJECT ("Excel. Application")
loExcel. DisplayAlerts =.F.
lcPath = loExcel. Path
loExcel. WorkBooks. Add ()
loWorkBook = loExcel. ActiveWorkBook
loExcel. Visible =. T.
loSheet = loWorkBook. WorkSheets (1)
loSheet. Cells (2,1).Value = 1
loSheet. Cells (3,1).Value = 2
* Actually it
loSheet. Range (loSheet. Cells (2,1), loSheet. Cells (3,1)).AutoFill (loSheet. Range (loSheet. Cells (2,1), loSheet. Cells (10,1)), 0)
loSheet. Range (loSheet. Cells (2,1), loSheet. Cells (2,1)).Select ()
CANCEL
```

Instead of:

```
loSheet. Range (loSheet. Cells (2,1), loSheet. Cells (3,1)).AutoFill (loSheet. Range (loSheet. Cells (2,1), loSheet. Cells (10,1)), 0)
loSheet. Range (loSheet. Cells (2,1), loSheet. Cells (2,1)).Select ()
```

It is possible to write simply:

```
loSheet. Range ("A2:A3").AutoFill (loSheet. Range ("A2:A10"), 0)
loSheet. Range ("A2").Select ()
```

Yes, the second function argument AutoFill (which Type: = xlFillDefault), here it is transferred as 0 (therefore as value xlFillDefault=0).

If to cling in the beginning Excel.h it would be possible to write down so:

`loSheet. Range ("A2:A3").AutoFill (loSheet. Range ("A2:A10"), xlFillDefault)`

And, here still that.

In the resulted piece instead of 2 lines:

```
Range ("A2:A3").Select
Selection. AutoFill (Range ("A2:A10"), xlFillDefault)
```

It is used simply:

`Range ("A2:A3").AutoFill (Range ("A2:A10"), xlFillDefault)`

EadleRus;

Thanks for a prompt reply.

But I need to move the formula in line on their all columns of all in one case 61, in other 108 (on other sheet)

mv123321;

If the formula in cell B1066 on columns B1066:BY1066 will be somehow so:

`loSheet. Range ("B1066").AutoFill (Range ("B1066:BY1066"), xlFillDefault)`

loSheet is an object of sheet of the book (from my example)

Here it:

```
LOCAL loExcel, loWorkBook, loSheet
loExcel = CREATEOBJECT ("Excel. Application")
loExcel. DisplayAlerts =.F.
loWorkBook = loExcel. WorkBooks. Open ("here a full path and a name of your excel-file")
loExcel. Visible =. T.
loSheet = loWorkBook. WorkSheets ("here a sheet name in an excel-file, or sheet number - but then without inverted commas")
* Actually it
loSheet. Range ("B1066").AutoFill (Range ("B1066:BY1066"), 0)
loSheet. Range ("B1066").Select ()
```

You can directly copy in a command window and launch ( at first changing file name and a sheet name)

EagleRus_;

exl. Range (exl. Cells (lrow, 2), exl. Cells (lrow, 61)).AutoFill (exl. Range (exl. Cells (lrow, 2), exl. Cells (lrow, 61)), 0)

Where here an error?

Thanks

mv123321;

1)

exl is that?

There should be a link to object of sheet. Not on object most Excel (!)

2)

The formula which should be multiplied, in what cell?

If in exl. Cells (lrow, 2), so:

```
exl. Range (exl. Cells (lrow, 2), exl. Cells (lrow, 2)).AutoFill (exl. Range (exl. Cells (lrow, 2), exl. Cells (lrow, 61)), 0)
^^^
```

EagleRus_;

Many thanks. Earned.

**Random topics**