I need a macro to copy the formulas in Sheet2 under columnD to as many rows as rows available in Sheet1.
Suppose if Sheet1 has entries in 12rows, then in sheet2 the formula in D1 should be copied and pasted from D2 to D12.
I need a macro to copy the formulas in Sheet2 under columnD to as many rows as rows available in Sheet1.
Suppose if Sheet1 has entries in 12rows, then in sheet2 the formula in D1 should be copied and pasted from D2 to D12.
Last edited by flakedew; 06-21-2012 at 03:23 AM.
Hi try this
![]()
Sub aa() Dim x As Long x = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row Worksheets("Sheet2").Range("d2").Copy Worksheets("Sheet1").Range("d2:d" & x).PasteSpecial Paste:=xlPasteFormulas End Sub
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
Thanx for your response..
Sorry, I didnt put it right in the first instance.
In Sheet1 the data entry starts from B9.
In sheet 2 the formulas from A3:U3 should be copied and pasted from A4:U4 to number of rows as per count of rows from B9 of Sheet1.
Please help.
Thanx for your response..
Sorry, I didnt put it right in the first instance.
I have revised the sample file
In Sheet1 the data entry starts from B9.
In sheet 2 the formulas from A3:U3 should be copied and pasted from A4:U4 to number of rows as per count of rows from B9 of Sheet1.
Please help.
Last edited by flakedew; 06-21-2012 at 03:24 AM.
Could You upload sample with all changes You have said above?
Sample file is attached for your reference please
Sorry I do not understand this
In sheet 2 the formulas from A3:U3 should be copied and pasted from A4:U4
Suppose in Sheet1 from row B9 there are entries upto B13,(total rows :5), then in Sheet2, select A3:U3, copy and paste from A4:U4 to A7:U7
From B1 to B8 in sheet1 it contains Header. Actual data entry starts from B9.
Ok take a look at this and tell me is it ok?
Of course first clear the range A4:U13 in sheet2 to see how this code works![]()
Sub aa() Dim x, y As Long x = Worksheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row - 9 y = Worksheets("Sheet2").Cells(2, Columns.Count).End(xlToLeft).Column Worksheets("Sheet2").Range("a3").Resize(x, y).FillDown End Sub
![]()
Sorry.. it did nt work.
the available formulas in A3:U3 got changed.
Look into attachment run code and check results (if it is not what you expected then make manually this what you need and send this back)
Last edited by tom1977; 06-21-2012 at 04:28 AM.
In the sample file attached, in sheet1, B8 contains Header, data entry starts from B9. there are total 11 entries.
In sheet2, Row A1 contains header, Row A2 is blank, RowA3:C3 contains formulas to pick data from Sheet1 and from C4:U4 some calculation formulas.
A3:U3 should be copied and pasted from A4:U4 to A13:U13 {10entries ( since the total entries in Sheet1 is 11 and already we have one entry in A3)}
the present code paste only A4:A12.
![]()
Sub aa() Dim x, y As Long x = Worksheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row - 9 y = Worksheets("Sheet2").Cells(1, Columns.Count).End(xlToLeft).Column Worksheets("Sheet2").Range("a3").Resize(x, y).FillDown End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks