Paste as values

Flaviolib

New Member
Joined
Sep 1, 2014
Messages
21
Hi,

Below formula works but it paste as formula. How can I change to paste as value?

Sub SaveFinalPrices()
Dim bottomD As Integer
Dim ws As Worksheet
For Each ws In Sheets(Array("A", "B", "C"))
ws.Activate
bottomD = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:M" & bottomD).Copy Sheets("Hist Prods").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Next ws
End Sub

Thanks
 
Hmmm, I'm getting lost on what should be doing what and where.

Maybe like this, where it refers to sheet "Hist Prods" column A range.

Code:
   Dim aRng As Range, c As Range

  Set aRng = Sheets("Hist Prods").Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
    For Each c In aRng
        If IsDate(c) Then c.ClearContents
    Next c

Howard
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Trying to clarify,

Before we do the loop through the sheets A, B, C copying to "Hist Prods" I want to clear some rows on "hist prods":

What I want to remove from "hist prod" is all rows where in cells from columns A I have a date = "refdate"

* column A is a date column
* "refdate" is a named range with a date that would be checked to delete rows on "hist prods"

hope it's good now
 
Upvote 0
So then we should run the date clear stuff for sheet "Hist Prods" first and follow with the for each sheet in array.

Does that do it the way you need?

Howard

Code:
Sub SaveFinalPrices()

'/*****
With Sheets("Hist Prods")
  Dim aRng As Range, c As Range

  Set aRng = Sheets("Hist Prods").Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
    For Each c In aRng
        If IsDate(c) Then c.ClearContents
    Next c
End With
'/*****


 Dim bottomD As Integer
 Dim ws As Worksheet

 For Each ws In Sheets(Array("A", "B", "C"))

   ws.Activate
   bottomD = Range("A" & Rows.Count).End(xlUp).Row
   Range("A2:M" & bottomD).Copy
  Sheets("Hist Prods").Cells(Rows.Count, "A").End(xlUp)(2).PasteSpecial Paste:=xlPasteValues

 Next ws
           
End Sub
 
Upvote 0
where I should include "refdate" ?

* all my column A cels have dates. just what to delete row when this date = "refdate"
 
Last edited:
Upvote 0
I'm guessing here, but try this on a test sheet. Using refdate instead of aRng.

Howard

Code:
With Sheets("Hist Prods")
  Dim refdate As Range, c As Range

    For Each c In refdate        
         If IsDate(c) Then c.ClearContents
    Next c
End With
 
Upvote 0
Hi mate,

Getting error: refdate=Nothing

Your for each should not loop on column A?
just to illustrate, I have a cell where I have my reference date that I call it in named range as "refdate".
I want to seek in below table on column A for any date equal to my "refdate"
So, for example below I'll delete Row 3 only, because cell A3 = "refdate".



Refdat:2-Sep
Column AColumn BColumn CColumn D
Row 128-AugMike30100
Row 21-SepJay31150
Row 32-SepEd32200

<colgroup><col width="101" span="5" style="width:76pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Can you post a link to an example workbook and re state what all you want to happen.

I think I have an idea of what you want, but an example workbook and all instructions would be very helpful.

I use Drop Box, but there are others.

Howard
 
Upvote 0
Hi

I think below will solve.
I'm just having problem with this line:
.AutoFilter 1, "=" & .Range(RngRefdate).Value

I think because this range is in other worksheet, not at "hist prods"

this range was created on workbook scope, there is a way to reference to it without specify the worksheet where it is?

Sub testDel()

Const RngRefdate = "refdate"


With Worksheets("Hist Prods")
.AutoFilterMode = False
With Range("A2", Range("A" & Rows.Count).End(xlUp))
.AutoFilter 1, "=" & .Range(RngRefdate).Value
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,649
Members
448,975
Latest member
sweeberry

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top