View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Autofill in macro

Can you look at a different column to determine how far to do the filling?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("g2").autofill _
destination:=.range("g2:g" & lastrow)
end with

I used column A to get that last row.

orquidea wrote:

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea


--

Dave Peterson