View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Using .AutoFill with a CELLS() reference

It works fine if Sheet1 is the activesheet. otherwsie try

With Worksheets("Sheet1")
.Range("G7").AutoFill Destination:=.Range(.CELLS(7,7),.CELLS(7,13)),
Type:=xlFillDefault
End With


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Greg Glynn" wrote in message
ups.com...
Hi,

This works:

Worksheets("Sheet1").Range("G7").AutoFill Destination:=Range("G7:K7"),
Type:=xlFillDefault

but this doesn't ...

Worksheets("Sheet1").Range("G7").AutoFill
Destination:=Range(CELLS(7,7),CELLS(7,13)), Type:=xlFillDefault

Can anyone suggest a way to autofill some column headings for numeric
number of columns?

Ideally, I'd like to do something like this:

Dim MyColumns as Integer
MyColumns = 8
Worksheets("Sheet1").Range("G7").AutoFill
Destination:=Range(CELLS(7,7),CELLS(7,7 + MyColumns)),
Type:=xlFillDefault

Any help would be appreciated.

Greg