View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Autofill Question

Dim lastrow as Long, lastcol as Long
lastrow = cells(rows.count,1).End(xlup).Row
lastcol = cells(1,columns.count).End(xlToLeft).Column

cells(2, lastcol + 1).Resize(lastrow-1, 1).Formula = "=A2*C2"

--
regards,
Tom Ogilvy


"Scott J" wrote:

I would like to use the autofill function but am not sure the best way to
start. I have a spreadsheet that will vary on the number of columns of data
and rows. I want to find the first blank column, select the second row
(first row I will place a header) place a formula in the second row and
autofill to the last row of data.

Assume current sheet has columns A:E
Assume 100 rows of data
Assume formula to autofill in column is A2*C2

Hopefully this makes sense,

Thanks,

SJ