AutoFill with no number sequence

Closed
Lance - Jun 10, 2010 at 03:20 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 10, 2010 at 04:32 PM
Hello,

I'd like to copy B1:B3 then autofill it till the last row of column A without the number sequence. Here's my code, I don't know what variables to change or add. Still new at this.


Sub Step2Add_New_Column()
'
' Step2Add_New_Column Macro
'

'

Dim LR As Integer

Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B1").Select
ActiveCell.FormulaR1C1 = "direct"
Range("B2").Select
ActiveCell.FormulaR1C1 = "indirect1"
Range("B3").Select
ActiveCell.FormulaR1C1 = "indirect2"
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("B1:B3").Select
Selection.AutoFill Destination:=Range("B1:B" & LR)
Range("B1:B" & LR).Select
Selection.Copy
Application.CutCopyMode = False

With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

End Sub


Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 10, 2010 at 04:32 PM
Add to your this line
Selection.AutoFill Destination:=Range("B1:B" & LR)

to


Selection.AutoFill Destination:=Range("B1:B" & LR), Type:=xlFillDefault

Just a suggestion, if you get stuck on some thing that you can do manually but are not sure about macro, record your action via excel macro recorder. I do that all the time, including this one.
0