ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofill (https://www.excelbanter.com/excel-programming/295225-autofill.html)

Mike Q.[_3_]

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
.



All times are GMT +1. The time now is 04:12 AM.

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