ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Autofill (https://www.excelbanter.com/excel-discussion-misc-queries/51587-autofill.html)

Dolphinv4

Autofill
 
Hi,

how do I write a macro such that it'll copy the active cell and then
autofill to the cell to the right of the active cell?

(ie, active cell is Jun-05 and if i do a manual mouse click drag to the
right, the right cell will show Jul-05)

Thanks,
Dolphin

Dolphinv4

Autofill
 
I tried this:

ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Offset(-1, 0).Resize(16),
Type:=xlFillDefault

But it don't work! Why?

Regards,
Dolphin

"Dolphinv4" wrote:

Hi,

how do I write a macro such that it'll copy the active cell and then
autofill to the cell to the right of the active cell?

(ie, active cell is Jun-05 and if i do a manual mouse click drag to the
right, the right cell will show Jul-05)

Thanks,
Dolphin


Stefi

Autofill
 
This will autofill ONE cell to the right to ActiveCell with next month, same
day:

Selection.AutoFill Destination:=ActiveCell.Resize(1, 2), Type:=xlFillMonths

From your example

Selection.AutoFill Destination:=ActiveCell.Offset(-1, 0).Resize(16),
Type:=xlFillDefault


I suppose you want to autofill 16 columns, if so, apply Resize(1,16)

Regards,
Stefi

"Dolphinv4" wrote:

I tried this:

ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Offset(-1, 0).Resize(16),
Type:=xlFillDefault

But it don't work! Why?

Regards,
Dolphin

"Dolphinv4" wrote:

Hi,

how do I write a macro such that it'll copy the active cell and then
autofill to the cell to the right of the active cell?

(ie, active cell is Jun-05 and if i do a manual mouse click drag to the
right, the right cell will show Jul-05)

Thanks,
Dolphin



All times are GMT +1. The time now is 11:03 AM.

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