View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Relative Reference and AutoFill- Macro

Missing a space:

Range("H2").AutoFill Destination:=Range("H2:H" & endrow)

--

Vasant


"Rowan" wrote in message
...
dim endRow as long
endRow = cells(rows.count,7).end(xlup).row
Range("H2").AutoFill Destination:=Range("H2:H" &endrow)

should give your the required result.

Regards
Rowan


"Andy Roberts" wrote:

I need to copy a formula in a new column for each row. When recording

the
macro I am using the autofill function however each time I use this
spreadsheet there will be a different number of rows. I need the

autofill to
adapt. The following is part of the script I think needs adjustment I

just
don't know how to adjust it. Thanks in advance for any ideas.

Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H423")
Range("H2:H423").Select