Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Copy Formula loop based on number of rows w/ data in a col B.

John,

You can look through the cells with formulas, copying each block of cells.
See the code below.

HTH,
Bernie
MS Excel MVP

Sub CopyRow2FormulasDownToMatchColumnB()
Dim myArea As Range
Dim myRow As Long

myRow = Range("B65536").End(xlUp).Row

For Each myArea In Range("2:2"). _
SpecialCells(xlCellTypeFormulas).Areas
myArea.Copy myArea.Resize(myRow - 1, 1)
Next myArea

End Sub



"John" wrote in message
...
I see many similar postings but haven't been able to apply their fixes to

my
problem. Here is hoping someone can help.

I have a file with heading info in row 1 and data entry starting in row 2.
Row 2 contains lookup formulas in cells A2, D2-F2, L2-X2 and AV2-AX2. A2
looks up a location number based on a unique identifier (location name)
manually input into B2, the other cells lookup based on the info in A2 (a
more reliable unique identifier).

Column B is where I input my initial data (location name). I need to copy
these formulas down as many rows as I have locations listed in column B.

For
instance, if I have 5 entries (unique identifiers listed in colum B, the
formulas in row 2 will copy down through row 6)

I prefer to have only the columns with formulas copied down, but at the

very
least will be happy if column B is not overwrited because it contians my

list
of locations.

Any help would be appreciated.

Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Copy Formula loop based on number of rows w/ data in a col B.

Hey - thanks Bernie It works perfect.

"Bernie Deitrick" wrote:

John,

You can look through the cells with formulas, copying each block of cells.
See the code below.

HTH,
Bernie
MS Excel MVP

Sub CopyRow2FormulasDownToMatchColumnB()
Dim myArea As Range
Dim myRow As Long

myRow = Range("B65536").End(xlUp).Row

For Each myArea In Range("2:2"). _
SpecialCells(xlCellTypeFormulas).Areas
myArea.Copy myArea.Resize(myRow - 1, 1)
Next myArea

End Sub



"John" wrote in message
...
I see many similar postings but haven't been able to apply their fixes to

my
problem. Here is hoping someone can help.

I have a file with heading info in row 1 and data entry starting in row 2.
Row 2 contains lookup formulas in cells A2, D2-F2, L2-X2 and AV2-AX2. A2
looks up a location number based on a unique identifier (location name)
manually input into B2, the other cells lookup based on the info in A2 (a
more reliable unique identifier).

Column B is where I input my initial data (location name). I need to copy
these formulas down as many rows as I have locations listed in column B.

For
instance, if I have 5 entries (unique identifiers listed in colum B, the
formulas in row 2 will copy down through row 6)

I prefer to have only the columns with formulas copied down, but at the

very
least will be happy if column B is not overwrited because it contians my

list
of locations.

Any help would be appreciated.

Thanks




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
Loop based on number entered in userform Richhall[_2_] Excel Worksheet Functions 1 September 17th 09 03:58 PM
Chart changing based on change in data source (number of rows/colu Bal Ram Bhui, Jakarta Charts and Charting in Excel 1 November 16th 08 06:02 AM
Compare and copy rows of data based on an ID# john mcmichael Excel Discussion (Misc queries) 1 July 9th 07 05:26 PM
Loop thru rows to copy to another excel spreadsheet eighthman11 Excel Worksheet Functions 0 October 9th 06 09:21 PM
constructing a copy-paste loop that skips rows hm[_2_] Excel Programming 1 September 22nd 03 07:05 PM


All times are GMT +1. The time now is 10:40 AM.

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"