Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Drag formula down till last row

Posted on 2012-04-05
4
Medium Priority
?
5,208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 34

Accepted Solution

by:
Norie earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

688 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