Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 709
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro: Copy data to another sheet Anders[_2_] Excel Discussion (Misc queries) 3 October 18th 09 01:43 PM
need a macro to copy the data to the following cells pol Excel Discussion (Misc queries) 10 July 21st 09 02:14 PM
Copy data in a macro. jfaz Excel Discussion (Misc queries) 1 July 13th 07 12:26 PM
Macro Help. Copy data from 1 workbook to another on next available Howeecow Excel Discussion (Misc queries) 0 June 6th 07 08:29 PM
Macro to move data to different column based on data in another co malycom Excel Discussion (Misc queries) 3 August 2nd 05 07:07 PM


All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"