AutoFill without sequential order

L

lancejularbal

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


Sub Step2Add_New_Column(

' Step2Add_New_Column Macr




Dim LR As Intege

Columns("B:B").Selec
Selection.Insert Shift:=xlToRigh
Range("B1").Selec
ActiveCell.FormulaR1C1 = "direct&quot
Range("B2").Selec
ActiveCell.FormulaR1C1 = "indirect1&quot
Range("B3").Selec
ActiveCell.FormulaR1C1 = "indirect2&quot
LR = Range("A" & Rows.Count).End(xlUp).Ro
Range("B1:B3").Selec
Selection.AutoFill Destination:=Range("B1:B" & LR
Range("B1:B" & LR).Selec
Selection.Cop
Application.CutCopyMode = Fals

With Selectio
.HorizontalAlignment = xlRigh
.VerticalAlignment = xlBotto
.WrapText = Fals
.Orientation =
.AddIndent = Fals
.IndentLevel =
.ShrinkToFit = Fals
.ReadingOrder = xlContex
.MergeCells = Fals
End Wit

End Su

Thanks for your time in advance!
 
J

James Ravenswood

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

 Thanks for your time in advance!

Say we start with:
1 abc
2 def
3 ghi
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

in cols A & B

This tiny macro:

Sub BringDownThree()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("B1:B3").Copy Range("B4:B" & n)
End Sub

will copy the B cells downward, producing:

1 abc
2 def
3 ghi
4 abc
5 def
6 ghi
7 abc
8 def
9 ghi
10 abc
11 def
12 ghi
13 abc
14 def
15 ghi
16 abc
17 def
18 ghi
19 abc
20 def
21 ghi
22 abc
23 def
24 ghi


gsnu201003
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top