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 would like to copy the formula of Cell A1 to A2:A10 by using the following
code, but it always shows the "Object required".

Sub copyfor()
With Range("A1").copy
Range("A2:A10").pastespecial = xlformula
End with
End Sub

Could someone show me the right way to do it.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default copy formula

Alan,

A good tip in solving issues like this is to record yourself doing it with
the macro recorder. Try this:-

Sub stantial()
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A10")
End Sub

Mike

"AlanW" wrote:

I would like to copy the formula of Cell A1 to A2:A10 by using the following
code, but it always shows the "Object required".

Sub copyfor()
With Range("A1").copy
Range("A2:A10").pastespecial = xlformula
End with
End Sub

Could someone show me the right way to do it.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default copy formula

Range("A1").Copy
Range("A2:A10").PasteSpecial Paste:=xlPasteFormulas

Regards

Trevor


"AlanW" wrote in message
...
I would like to copy the formula of Cell A1 to A2:A10 by using the
following
code, but it always shows the "Object required".

Sub copyfor()
With Range("A1").copy
Range("A2:A10").pastespecial = xlformula
End with
End Sub

Could someone show me the right way to do it.

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default copy formula

On 10 ruj, 09:30, AlanW wrote:
I would like to copy the formula of Cell A1 to A2:A10 by using the following
code, but it always shows the "Object required".

Sub copyfor()
With Range("A1").copy
Range("A2:A10").pastespecial = xlformula
End with
End Sub

Could someone show me the right way to do it.

Thanks


Alan,

Range("A2:A10").Formula = Range("A1").Formula

Regards

Iztok

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
copy formula result (text) only - without copying formula Mulberry Excel Discussion (Misc queries) 2 October 2nd 08 09:51 AM
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 05:36 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"