Solved

Drag formula down till last row

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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…

628 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