Thread: Autofill range
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Autofill range

Try something like

Dim RowCounter As Long
RowCounter = Range("G1").Value
Selection.AutoFill Destination:=Range(Range("A1"), Cells(RowCounter, "A"))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Wendy" wrote in message
...
Hi

I'm trying to autofill a column using Selection.AutoFill Destination:=
Range(A1, rowcounter)

where rowcounter = Application.Sheets(2).Range("G1").value
G1 is =CountA(A:A)

The rowcounter has the correct rownumber in it but the auto fill fails
with
Method 'Range' of object '_global' failed

What I am doing is using a formula to put the contents of column B with
some
additions into column A. It works using
Selection.AutoFill Destination:=
ActiveCell.Range(Selection,Selection.End(x1Down)), Type:=_
x1FillValues
but it fills down to 65536 there are only 1210 rows of data this time.

Thanks

Wendy