Macro to populate formula using Autofill

Closed
mayek25 Posts 4 Registration date Thursday 4 July 2013 Status Member Last seen 16 July 2013 - 4 Jul 2013 à 21:45
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 15 Jul 2013 à 11:26
i have 2 worksheets, A & B.
In worksheet A, i have the data in cell F2, F3, F4.

In worksheet B, i would like to refer worksheetA!F2 in Column G, worksheetA!F3 in Column H and worksheetA!F4 in Column J. The data in worksheet B would be autofilled all the way down from row 2 to as long as Column B has data.

Could someone pls help? I'm a newbie to macros.

Thanks.
Related:

3 responses

TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 555
9 Jul 2013 à 11:50
Hi Mayek,

Here is your requested code:
Sub AutofillGHJ()
Dim lRow As Integer

Sheets("B").Select

lRow = Range("B" & Rows.Count).End(xlUp).Row
Range("G1:H1").Autofill Range("G1:H" & lRow)
Range("J1").Autofill Range("J1:J" & lRow)
    
End Sub

Best regards,
Trowa
mayek25 Posts 4 Registration date Thursday 4 July 2013 Status Member Last seen 16 July 2013
9 Jul 2013 à 21:01
Hi Trowa,

I actually managed to figure out the macros by using recording and modifying it from there. Although it is slightly long, but its workable. The macros you had provided are very simple and workable.

Thank you.

Regards
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 555
15 Jul 2013 à 11:26
Hi Mayek,

Hopefully it will help you in creating smaller macro's. As this will be beneficial to the file size.

Best regards,
Trowa