Macro to copy formula if cell has value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a what I think is a simple code to run a macro. What I have
is a spreadsheet where I am going to paste many rows of data in columns A
through E. I then want this macro to run and copy the forumulas I have in
cells F7:Z7 down until the data is null in Columns A thru E. I hope this
makes sense and can be done.
 
Sub CopyFormulas()
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("F7:Z7").Resize(lastrow - 6).FillDown
End Sub

HTH
 
Assume column A can be used to determine the extent

Sub copyformulas()
Dim rng As Range
Set rng = Range(Cells(1, 1), _
Cells(Rows.Count, 1).End(xlUp))
rng.Offset(0, 5).Resize(, 21).FillDown
End Sub
 
Tom, can you give some clarity on to how this can be modified? I am trying
something simliar to copy the formulas from cells N2 and O2, it would also be
nice to be able to "purge" those rows in a cleaner manner than "select range
N3:O6500 clear contents"
 

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