Solved

Drag formula down till last row

Posted on 2012-04-05
4
3,697 Views
Last Modified: 2012-04-05
Hello All,
I need a vba code in excel that does the following trick.
The code copies the formula in the last two columns (F10, G10) down to the last row when refresh is clicked. If I add a new row at the end, the last two columns formulas don’t work properly. Only when I re-copy the top cell g10 and drag it down to G19, then it works again.
So the idea of the refresh button (when I click it) is to copy the formulas from the first cell in the G column to the last recent end cell in that column. The copy will happen till it reaches the last row value in C column

Thank you
copy-formulas-down-depending.xlsx
0
Comment
Question by:Rayne
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 37814332
Rayne,

take a peak at the attached link. I believe that will get you started in the right direction.
vba to fill down formulae just in rows that hold data

Good luck!
0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 37814369
Try this.
Sub CheckBox1_Click()
Dim LastRow As Long

    LastRow = Range("C" & Rows.Count).End(xlUp).Row
    
    Range("F10:G10").Copy Range("F10:G" & LastRow)
    
End Sub

Open in new window

0
 

Author Comment

by:Rayne
ID: 37814434
Thank you imnorie, That looks awesome.
0
 

Author Closing Comment

by:Rayne
ID: 37814436
quick help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now