Copy formula

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:21 PM GMT

Question

Here's the scenario...

In cell A1 I have a number '20', in B1 there is a formula, Would it be possible to automatically copy the formula in B1 until B20 without me doing it manually?How? The number '20' in A1 is the determinant on how many copy of the formula in B1 I want to have. For example I change the number in A1 to 45, then the formula in B1 will be copied in until B45.


Answer

Jn

This will do what you asked.

Sub Macro1()

   x = Range("A1").Value
   Range("b1").Copy
   Range("b1").Resize(x, 1).Select
   ActiveSheet.Paste
   Application.CutCopyMode = False

End Sub

I hope it helps get you started; I suspect you will need some error checking and come up with an efficient way to trigger the macro.

Advertisement

©2024 eLuminary LLC. All rights reserved.