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

How would someone copy the last row of data on a sheet, go
down one row, paste only the formulas, then go to the
original row and paste the values. The original row would
have the same values but no formulas and the next row
would then have the formulas. This needs to be dynamic
because the rows would increase by one row daily and the
reference would change each day. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dynamic Copy/Paste Special Formulas/Paste Special Values

Assume the formulas should not adjust:

Sub ProcessLastRow()
Dim rng as Range, rng1 as Range
Dim cell as Range
set rng = Cells(rows.count,1).end(xlup)
set rng1 = Range(cells(rng.row,1),Cells(rng.row,256).End(xlto Left))
rng1.copy
rng1.offset(1,0).pastespecial xlFormats
for each cell in rng1
if cell.hasformula then
cell.offset(1,0).Formula = cell.formula
cell.formula = cell.Value
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"Sharon Perez" wrote in message
...
How would someone copy the last row of data on a sheet, go
down one row, paste only the formulas, then go to the
original row and paste the values. The original row would
have the same values but no formulas and the next row
would then have the formulas. This needs to be dynamic
because the rows would increase by one row daily and the
reference would change each day. Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Dynamic Copy/Paste Special Formulas/Paste Special Values

Take a look at David McRitchie's INSRTRow macro:


http://www.mvps.org/dmcritchie/excel/insrtrow.htm


In article ,
"Sharon Perez" wrote:

How would someone copy the last row of data on a sheet, go
down one row, paste only the formulas, then go to the
original row and paste the values. The original row would
have the same values but no formulas and the next row
would then have the formulas. This needs to be dynamic
because the rows would increase by one row daily and the
reference would change each day. Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Dynamic Copy/Paste Special Formulas/Paste Special Values

Here's the basic sequence I use a lot:
Assumming you have just selected the cell to be copied, then:
Selection.Copy
ActiveCell.Offset(1,0).Select
ActiveSheet.Paste '(Copy formula)
ActiveCell.Offset(-1,0).Select
Selection.PasteSpecial Paste=xlValues '(Remove formula)
NOTE: This sequence will NOT remove conditional formatting
To remove conditional formatting use:
Selection.FormatConditions.Delete
-----Original Message-----
Assume the formulas should not adjust:

Sub ProcessLastRow()
Dim rng as Range, rng1 as Range
Dim cell as Range
set rng = Cells(rows.count,1).end(xlup)
set rng1 =

Range(cells(rng.row,1),Cells(rng.row,256).End(xlto Left))
rng1.copy
rng1.offset(1,0).pastespecial xlFormats
for each cell in rng1
if cell.hasformula then
cell.offset(1,0).Formula = cell.formula
cell.formula = cell.Value
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"Sharon Perez" wrote in message
...
How would someone copy the last row of data on a sheet, go
down one row, paste only the formulas, then go to the
original row and paste the values. The original row would
have the same values but no formulas and the next row
would then have the formulas. This needs to be dynamic
because the rows would increase by one row daily and the
reference would change each day. 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
my paste special function won't let me copy formulas squintana Excel Worksheet Functions 4 April 3rd 23 07:41 PM
Changing Of Values After A Copy And Paste Special: Why ? Bob[_19_] Excel Discussion (Misc queries) 1 March 15th 10 11:44 PM
Copy Values only without Paste Special karl Excel Discussion (Misc queries) 6 December 22nd 08 02:03 AM
Copy / Paste Special / Values for a whole spreadsheet ? Colin2 Excel Discussion (Misc queries) 4 May 23rd 06 05:11 PM
How to copy formulas to a new workbook? Paste Special is different MS-Requestor Excel Worksheet Functions 2 May 10th 06 10:19 PM


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