Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lh
 
Posts: n/a
Default Macro to copy range of formulas to equal data lines

I would like to have a macro to copy a range of formulas in row 2 down for
all lines of input in an adjacent range. For example:

Input Formula
Row 2 Cell X2 Cell Y2
Row 3
Row 4
Row 5

In input date in the range Row2 through Row 5. I want to copy the formulas
in Cells X2 and Y2 down for the other three lines of input.

Thanks for any help that you can provide.
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Hmmm. What column gets the dates?

Option Explicit
Sub testme01()

Dim LastRow As Long
Dim FirstRow As Long

With ActiveSheet
FirstRow = 2 'headers in row 1?
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row 'I used column A.

.Range(.Cells(FirstRow, "C"), .Cells(LastRow, "C")).FormulaR1C1 _
= .Cells(FirstRow, "C").FormulaR1C1

.Range(.Cells(FirstRow, "d"), .Cells(LastRow, "d")).FormulaR1C1 _
= .Cells(FirstRow, "d").FormulaR1C1

End With

End Sub




lh wrote:

I would like to have a macro to copy a range of formulas in row 2 down for
all lines of input in an adjacent range. For example:

Input Formula
Row 2 Cell X2 Cell Y2
Row 3
Row 4
Row 5

In input date in the range Row2 through Row 5. I want to copy the formulas
in Cells X2 and Y2 down for the other three lines of input.

Thanks for any help that you can provide.


--

Dave Peterson
  #3   Report Post  
lh
 
Posts: n/a
Default

Dave,

This worked great.

Thanks.

Lori

"Dave Peterson" wrote:

Hmmm. What column gets the dates?

Option Explicit
Sub testme01()

Dim LastRow As Long
Dim FirstRow As Long

With ActiveSheet
FirstRow = 2 'headers in row 1?
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row 'I used column A.

.Range(.Cells(FirstRow, "C"), .Cells(LastRow, "C")).FormulaR1C1 _
= .Cells(FirstRow, "C").FormulaR1C1

.Range(.Cells(FirstRow, "d"), .Cells(LastRow, "d")).FormulaR1C1 _
= .Cells(FirstRow, "d").FormulaR1C1

End With

End Sub




lh wrote:

I would like to have a macro to copy a range of formulas in row 2 down for
all lines of input in an adjacent range. For example:

Input Formula
Row 2 Cell X2 Cell Y2
Row 3
Row 4
Row 5

In input date in the range Row2 through Row 5. I want to copy the formulas
in Cells X2 and Y2 down for the other three lines of input.

Thanks for any help that you can provide.


--

Dave Peterson

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
Data Range Mess Karen Charts and Charting in Excel 18 January 14th 06 02:34 PM
Macro to search for and display data in another worksheet Mark H Excel Worksheet Functions 0 June 14th 05 12:40 PM
Copy range of cells omitting formulas that result in " " Plot only cells with values in column Excel Discussion (Misc queries) 1 May 24th 05 08:52 PM
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM


All times are GMT +1. The time now is 07:24 AM.

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

About Us

"It's about Microsoft Excel"