ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlFillFormats; Fill 9 Columns to the Right (https://www.excelbanter.com/excel-programming/421675-xlfillformats%3B-fill-9-columns-right.html)

ryguy7272

xlFillFormats; Fill 9 Columns to the Right
 
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---
--
RyGuy

Barb Reinhardt

xlFillFormats; Fill 9 Columns to the Right
 
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

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"ryguy7272" wrote:

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---
--
RyGuy



All times are GMT +1. The time now is 10:33 AM.

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