Autofill

  • Thread starter Thread starter carg1
  • Start date Start date
C

carg1

How would I make autofill work in a macro without having to explicitl
specify the range of cells I want to fill? I have a sheet in which th
number of rows changes all the time, and I need to autofill equations a
the beginning of two columns
 
This assumes that column 1 contains all the rows that need the formula
applied to and cell H1 contains the initial formula. Duplicate the copy/paste
process for multiple, non-adjacent columns. For adjacent columns, you could
"resize" the copy (".Resize(1, 2)").

Sub procFillFormulas()
Cells(1, 8).Copy
Range(Cells(2, 8), Cells(Cells(Rows.Count, 1).End(xlUp).Row,
8)).PasteSpecial xlPasteFormulas
Application.CutCopyMode = False
End Sub

Dale Preuss
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top