Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro: Copy data to another sheet | Excel Discussion (Misc queries) | |||
need a macro to copy the data to the following cells | Excel Discussion (Misc queries) | |||
Copy data in a macro. | Excel Discussion (Misc queries) | |||
Macro Help. Copy data from 1 workbook to another on next available | Excel Discussion (Misc queries) | |||
Macro to move data to different column based on data in another co | Excel Discussion (Misc queries) |