xlFillFormats; Fill 9 Columns to the Right

R

ryguy7272

I'm not sure why my last post didn't show up; trying again:

ActiveCell.Resize(, 9).Select
'Selection.AutoFill Destination:=.Range(.Cells(, 9), Type:=xlFillFormats

This code fails on the second line (that's why it is commented out).
How can I make it run?

Thanks,
Ryan---
 
B

Barb Reinhardt

Try something like this.

Option Explicit

Sub test()
Dim myWS As Worksheet
Dim SourceRange As Range
Dim FillRange As Range


Set myWS = Worksheets("Sheet1")

Set SourceRange = myWS.Range("A1:A2")
Set FillRange = myWS.Range("A1:A20")
SourceRange.AutoFill Destination:=FillRange, Type:=xlFillFormats

End Sub
 
Top