Hi,
I have a problem with the Autofill. I want to have and autofill that is dynamic because i need to insert ans delete column.
Here.s the basic autofill:
Here's what I try to have a autofill that autofill me the last column but it does not work... :
Thanks for your help!
J-M
I have a problem with the Autofill. I want to have and autofill that is dynamic because i need to insert ans delete column.
Here.s the basic autofill:
Code:
Range("AM2:AN12").Select
Selection.AutoFill Destination:=Range("AM2:AN100"), Type:=xlFillDefault
Here's what I try to have a autofill that autofill me the last column but it does not work... :
Code:
Sub Last_Real_Populated_Column()
ActiveCell.SpecialCells(xlLastCell).Select
LastR = ActiveCell.Row
LastC = ActiveCell.Column
LastRealC = 1
For Counter = LastC To 1 Step -1
Range(Cells(LastR, Counter), Cells(LastR, Counter)).Select
Selection.End(xlUp).Select
If Not IsEmpty(ActiveCell.Value) Then
LastRealC = ActiveCell.Column
Exit For
End If
Next
Selection.End(xlUp).Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
[COLOR=red]Selection.Name = "dest"[/COLOR]
[COLOR=red]Selection.AutoFill Destination:=Range(dest), Type:=xlFillDefault[/COLOR]
Thanks for your help!
J-M
Last edited: