VBA/Macro to copy down a formula to row indicated in cell with formula

kwest3904

New Member
Joined
May 30, 2023
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Need VBA/ macro that will copy a formula from a cells N2:AC2 into N3: N??? with the ??? being row number determined by a formula in O1

For example, if O1 has value 200, it would copy N2:AC2 to column N from rows 3 to 200

Tried the below based on similar questions and answers but neither works.

Range("N3:N" & Range("O1").Value).Formula = Range("N2:AC2").Formula

Range("N2:AC2").AutoFill Destination:=Range("N3").Resize(Sheets("E123 COMMZ").Range("o1").Value, 1)

The data is in tab named 'E123 COMMZ'

Thanks!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Welcome to the Board!

Try this:
VBA Code:
Range("N2:AC2").Copy Range("N3:N" & Sheets("E123 COMMZ").Range("O1").Value)
 
Upvote 0
Or May be
VBA Code:
Range("N3:N" & Sheets("E123 COMMZ").Range("O1").Value).Formula = Application.Transpose(Range("N2:AC2").Formula)
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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
Back
Top