Thread: Autofill
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Q.[_3_] Mike Q.[_3_] is offline
external usenet poster
 
Posts: 4
Default Autofill

Selection.AutoFill Destination:=Range("C2:C" & row)
I think the above should be:
Selection.AutoFill Destination:=Range("C1:C" & row)

-----Original Message-----
Howcome my autofill code does not work?

Any help is appriciated!

Private Sub FilePrep_Click()

Dim row As Integer

row = 2

Do While Not Range("B" & row) = ""
row = row + 1
Loop

row = row - 1

Columns("C:C").Select
Selection.Insert Shift:=xlToRight

Range("C1").Select
ActiveCell.FormulaR1C1 = "=RC[-2]&"";""&RC[-1]"

Columns("C:C").EntireColumn.AutoFit
Range("C1").Select
Selection.AutoFill Destination:=Range("C2:C" & row)
Range("C1:C" & row).Select
Columns("C:C").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues,

Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("A:B").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft

Range("A8").Select

End Sub
.