Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default Paste values macro

I have 500 rows with formulas in them, some of which have calculated values
and therefore there is data sitting in them.

I would like a macro to paste the values of the rows in which data has been
calculated, leaving the uncalculated rows with the same formula in them.

I then need to delete entire rows of the pasted values if a date value
exists in column K.

I have been ripping my hair out over this so any help would be much
appreciated.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Paste values macro

Hi Tony

Is there a way you can differentiate your uncalculated rows from your
calculated rows when both of these rows have cells which all contain
formulas ?

Carim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Paste values macro

if the calculate values are numbers and the uncalculated values are text

for example they may contain a formula like

=if(A1<"",A1*20,"")

then you can do something like:

Sub FixFormulas()
Dim rng As Range
On Error Resume Next
Set rng = Cells.SpecialCells(xlFormulas, xlNumbers)
On Error GoTo 0
If Not rng Is Nothing Then
For Each cell In rng
cell.Formula = cell.Value
Next
End If
End Sub

'for deleting rows

Sub DeleteRows()
Dim lastrow As Long, i As Long
Dim rng As Range
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = lastrow To 1 Step -1
If IsDate(Cells(i, "K")) Then
On Error Resume Next
Set rng = Rows(i).SpecialCells(xlFormulas)
On Error GoTo 0
If rng Is Nothing Then
Rows(i).Delete
End If
End If
Next
End Sub


--
Regards,
Tom Ogilvy



"Tony" wrote in message
...
I have 500 rows with formulas in them, some of which have calculated

values
and therefore there is data sitting in them.

I would like a macro to paste the values of the rows in which data has

been
calculated, leaving the uncalculated rows with the same formula in them.

I then need to delete entire rows of the pasted values if a date value
exists in column K.

I have been ripping my hair out over this so any help would be much
appreciated.

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
Macro to Cut and paste Values tr Excel Discussion (Misc queries) 2 May 25th 10 09:58 PM
Macro: Paste Values Jennifer Excel Discussion (Misc queries) 4 July 14th 08 06:07 PM
Paste values - macro yshridhar Excel Discussion (Misc queries) 4 March 25th 08 06:36 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 03:21 AM.

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"