Solved

Drag formula down till last row

Posted on 2012-04-05
4
3,534 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

708 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

15 Experts available now in Live!

Get 1:1 Help Now