Autofill macro

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

Question

mimi dot jacob at heartplace dot com


I am brand new at vba. I have spent hours trying to figure this out. Gone to forums and can't seem to make my macro work.

I am trying to copy a formula from Worksheet A and put it in Worksheet B. The formula needs to be pasted starting at column D2 and then autofill until the last cell. The last cell would be based on looking at column C. Column C is a date field. Do I need to change anything if Column C is a currency or accounting field?

Thank you so much, Mimi

Answer

Mimi,


with worksheets("Worksheet B")

 set r = .range("D2",.cells(.rows.count,"C").End(xlup).offset(1,0))

End with r.Formula = worksheets("Worksheet A").Range("B9").Formula


change B9 to the cell that contains the formula.

this assumes the formula is configured for entry into column D2.

as long as there is data in the last row you want to use in column C, it doesn't make any difference what it is.

Advertisement

©2024 eLuminary LLC. All rights reserved.