Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to Copy Formulas not Values ...

Hi Excellences! :-)

I want to copy one row to another row,
I'm interested in copying only Excel FORMULAS not VALUES.
I made PasteSpecial - Paste - Formulas
and it turned out that VALUES of copied row
are pasted into a new row.
As I mentioned I want only FORMULAS on the new row.
I tried also to write a macro but it was no success.

How to do it?

Any help will be greatly appreciated!

Best regards

Ronnie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Copy Formulas not Values ...

Sub CopyFormulas()
Dim rng As Range, cell As Range
Dim rw As Long
rw = 5
On Error Resume Next
Set rng = Rows(1).SpecialCells(xlFormulas)
On Error GoTo 0
if not rng is nothing then
For Each cell In rng
cell.Copy
Cells(rw, cell.Column).PasteSpecial xlFormulas
Next
End if
End Sub

is one way. As written, copies from Row 1 to Row 5. If you wanted to copy
from Row 1 to the row with the activeCell

Sub CopyFormulas()
Dim rng As Range, cell As Range
Dim rw As Long
rw = ActiveCell.Row
On Error Resume Next
Set rng = Rows(1).SpecialCells(xlFormulas)
On Error GoTo 0
If not rng is nothing then
For Each cell In rng
cell.Copy
Cells(rw, cell.Column).PasteSpecial xlFormulas
Next
End if
End Sub



--
Regards,
Tom Ogilvy




"Ronnie" wrote in message
...
Hi Excellences! :-)

I want to copy one row to another row,
I'm interested in copying only Excel FORMULAS not VALUES.
I made PasteSpecial - Paste - Formulas
and it turned out that VALUES of copied row
are pasted into a new row.
As I mentioned I want only FORMULAS on the new row.
I tried also to write a macro but it was no success.

How to do it?

Any help will be greatly appreciated!

Best regards

Ronnie




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to Copy Formulas not Values ...

Thank you voey much for help!

Best regards

Ronnie

"Tom Ogilvy" wrote
...
Sub CopyFormulas()
Dim rng As Range, cell As Range
Dim rw As Long
rw = 5
On Error Resume Next
Set rng = Rows(1).SpecialCells(xlFormulas)
On Error GoTo 0
if not rng is nothing then
For Each cell In rng
cell.Copy
Cells(rw, cell.Column).PasteSpecial xlFormulas
Next
End if
End Sub

is one way. As written, copies from Row 1 to Row 5. If you wanted to

copy
from Row 1 to the row with the activeCell

Sub CopyFormulas()
Dim rng As Range, cell As Range
Dim rw As Long
rw = ActiveCell.Row
On Error Resume Next
Set rng = Rows(1).SpecialCells(xlFormulas)
On Error GoTo 0
If not rng is nothing then
For Each cell In rng
cell.Copy
Cells(rw, cell.Column).PasteSpecial xlFormulas
Next
End if
End Sub





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
how do i copy values between tables using relative formulas ther00k Excel Discussion (Misc queries) 1 December 21st 07 09:23 AM
Copy a file with only values no formulas Lee Coleman New Users to Excel 2 April 6th 07 04:43 PM
copy formulas without associated values dranreb Excel Worksheet Functions 0 April 3rd 06 10:22 PM
Copy Values in a cell (derived from formulas) Ali Excel Worksheet Functions 2 January 19th 06 02:18 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


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