How to drag formula down to second last row in column A?

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
634
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

With the help of people on this board, I've used this code to copy a formula to cell I4, then drag it down column I until the number of rows populated in column G.

However, I would like to drag it down to the second last row populated in column G.

Does anyone know how to do this, please?


VBA Code:
Range("I1").Copy
Range("I4:I" & Range("G" & Rows.Count).End(xlUp).Row).PasteSpecial xlPasteFormulas
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,252
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Range("I4:I" & Range("G" & Rows.Count).End(xlUp).Offset(-1).Row).PasteSpecial xlPasteFormulas
 

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
634
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Excellent!

Thanks Fluff - that worked!!

Thank you!
 

Watch MrExcel Video

Forum statistics

Threads
1,126,984
Messages
5,621,981
Members
415,871
Latest member
Frank_Aa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top