![]() |
Macro to copy data when data is detected in another column(s).
I'm using excel 2007 to run a Macro. My macro inserts data in P2, Q2, R2, S2,
(my headers) P2, Q2, R2, S2 (my formulas). The macro works perfectly but I would add on to it. On Columns A-O I always have data (I extract it from another application), but depending on the day I might have 50 rows, 60 row, 100 rows, etc... I would like to add on to my macro to copy the formulas from P2, Q2, R2, S2 down the row, say P3:P, Q3:Q, R3:R, S3:S; until no more data is detected from columns A-O. If this helps, on certain columns (C and O) I have the exact same data. |
Macro to copy data when data is detected in another column(s).
Hi
First, we calculate last row, then we fill down the formulas in row 2.... LastRow = Range("A" & Rows.Count).End(xlUp).Row Range("P2:S" & LastRow).FillDown Regards, Per On 23 Okt., 23:05, Richard wrote: I'm using excel 2007 to run a Macro. My macro inserts data in P2, Q2, R2, S2, (my headers) P2, Q2, R2, S2 (my formulas). *The macro works perfectly but I would add on to it. *On Columns A-O I always have data (I extract it from another application), but depending on the day I might have 50 rows, 60 row, 100 rows, etc... I would like to add on to my macro to copy the formulas from P2, Q2, R2, S2 down the row, say P3:P, Q3:Q, R3:R, S3:S; until no more data is detected from columns A-O. If this helps, on certain columns (C and O) I have the exact same data. |
Macro to copy data when data is detected in another column(s).
Assuming column C will be filled at least as far down as other columns in
A:O Sub Auto_Fill() Dim lRow As Long With ActiveSheet lRow = .Range("C" & Rows.Count).End(xlUp).Row .Range("P2:S" & lRow).FillDown End With End Sub BTW...........I am also assuming that your headers are P1:S1 and you have a typo in your description. Gord Dibben MS Excel MVP On Fri, 23 Oct 2009 14:05:02 -0700, Richard wrote: I'm using excel 2007 to run a Macro. My macro inserts data in P2, Q2, R2, S2, (my headers) P2, Q2, R2, S2 (my formulas). The macro works perfectly but I would add on to it. On Columns A-O I always have data (I extract it from another application), but depending on the day I might have 50 rows, 60 row, 100 rows, etc... I would like to add on to my macro to copy the formulas from P2, Q2, R2, S2 down the row, say P3:P, Q3:Q, R3:R, S3:S; until no more data is detected from columns A-O. If this helps, on certain columns (C and O) I have the exact same data. |
All times are GMT +1. The time now is 10:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com