Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Copying Formula's

Using CopyFromRecordset, my VB code copies data to "Sheet2" of a
spreadsheet.

"Sheet3" contains formula's that utilize the data in "Sheet2".

The number of records in "Sheet2" vary (one time there may be 100 and
the next time there may be 200).

The cells on "Sheet3, row 2" contain the formulas corresponding to
"Sheet2, row 2".

How can I get VB to copy the "Sheet3's" formula's down from row 2 to
the last row corresponding to the block of data in "Sheet2"?

Thanks for any suggestions.

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Copying Formula's

Mark,

Worksheets("Sheet3").Range("2:2").Copy _
Worksheets("Sheet3").Range("3:" & _
Worksheets("Sheet2").Range("A65536").End(xlUp)(2). Row)

HTH,
Bernie
MS Excel MVP

"Mark" wrote in message
om...
Using CopyFromRecordset, my VB code copies data to "Sheet2" of a
spreadsheet.

"Sheet3" contains formula's that utilize the data in "Sheet2".

The number of records in "Sheet2" vary (one time there may be 100

and
the next time there may be 200).

The cells on "Sheet3, row 2" contain the formulas corresponding to
"Sheet2, row 2".

How can I get VB to copy the "Sheet3's" formula's down from row 2 to
the last row corresponding to the block of data in "Sheet2"?

Thanks for any suggestions.

Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Copying Formula's

Mark,

assuming from the location that both sheets have titles in
Row 1, try this.

Limit = application.worksheetfunction.counta(sheets("sheet
2").Range("A2:A65536"))
Sheets("Sheet 3").Range("A2:J2").copy destination:= sheets
("Sheet 3").Range(sheets("Sheet 3").Cells(3,1),sheets
("Sheet 3").cells(Limit+3,1))

Pete.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Copying Formula's

I'm sorry - I didn't actually test the code -
Worksheets("Sheet2").Range("A65536").End(xlUp)(2). Row)
should really be
Worksheets("Sheet2").Range("A65536").End(xlUp).Row )

I use the (2) to find the first empty cell, and it's gotten to be a
habit. ;-)

HTH,
Bernie
MS Excel MVP

"Bernie Deitrick" wrote in message
...
Mark,

Worksheets("Sheet3").Range("2:2").Copy _
Worksheets("Sheet3").Range("3:" & _
Worksheets("Sheet2").Range("A65536").End(xlUp)(2). Row)

HTH,
Bernie
MS Excel MVP

"Mark" wrote in message
om...
Using CopyFromRecordset, my VB code copies data to "Sheet2" of a
spreadsheet.

"Sheet3" contains formula's that utilize the data in "Sheet2".

The number of records in "Sheet2" vary (one time there may be 100

and
the next time there may be 200).

The cells on "Sheet3, row 2" contain the formulas corresponding to
"Sheet2, row 2".

How can I get VB to copy the "Sheet3's" formula's down from row 2

to
the last row corresponding to the block of data in "Sheet2"?

Thanks for any suggestions.

Mark





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
FORMULA'S adnil Excel Discussion (Misc queries) 2 July 25th 09 08:21 AM
formula's MadisonNYC Excel Discussion (Misc queries) 7 May 31st 06 02:07 AM
formula's Cindy Excel Discussion (Misc queries) 4 January 20th 06 04:35 PM
IF formula's alice Excel Discussion (Misc queries) 3 January 20th 06 03:42 PM
how do i copy a formula's result to another cell, without copying. Mili Excel Worksheet Functions 1 March 29th 05 01:53 AM


All times are GMT +1. The time now is 10:09 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"