Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default copy formula

I want to copy a formuala down a column. There maybe blank spaces in
my column. My last row is 5000 but may grow maybe to 10000. I have not
seen it coded like this (using Offset and End xlUp) before but it
appears to work. Is this OK to code like this? Other people seem to
code using something like this -
Range(Range("A2"),Cells(rows.count,"A").End(xlup)) .

Thanks


For Each cll In Range("q6:da6")
If cll.HasFormula = True Then
cll.Copy
Range(cll, cll.Offset(30000, 0).End(xlUp)).PasteSpecial

End If
Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default copy formula

Snax,

The answer is, of course, "It depends."

The code that you posted would work to copy over any cells that are already
filled. If the formulas need to be copied down further, then it won't do
that.

Here's code that should work: you don't need the conditional:

Dim myRow As Long
Dim myCell As Range

'Change the A to a column that sets your table size
myRow = Range("A65536").End(xlUp).Row
For Each myCell In Range("q6:da6").SpecialCells(xlCellTypeFormulas)
myCell.Copy Range(myCell, Cells(myRow, myCell.Column))
Next myCell





--
HTH,
Bernie
MS Excel MVP
"snax500" wrote in message
om...
I want to copy a formuala down a column. There maybe blank spaces in
my column. My last row is 5000 but may grow maybe to 10000. I have not
seen it coded like this (using Offset and End xlUp) before but it
appears to work. Is this OK to code like this? Other people seem to
code using something like this -
Range(Range("A2"),Cells(rows.count,"A").End(xlup)) .

Thanks


For Each cll In Range("q6:da6")
If cll.HasFormula = True Then
cll.Copy
Range(cll, cll.Offset(30000, 0).End(xlUp)).PasteSpecial

End If
Next



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
Excel formula to copy/paste formula needed please. colwyn Excel Discussion (Misc queries) 4 October 22nd 08 11:27 PM
I copy a formula and the results copy from the original cell brooklynsd Excel Discussion (Misc queries) 1 June 23rd 07 01:35 AM
copy formula down a column and have cell references change within formula brad New Users to Excel 5 May 13th 07 04:38 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Copy formula so destination displays formula as text Omunene Excel Discussion (Misc queries) 2 September 30th 05 06:28 PM


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

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"