PC Review


Reply
Thread Tools Rate Thread

Copy to specified sheet, values only

 
 
PVANS
Guest
Posts: n/a
 
      31st Mar 2010
Good morning

I hope someone can help me with this. I am currently using the following
code to copy the entire data from one sheet, and paste it below the previous
data in a different sheet:

Set srcsht = Sheets("Working")
Set dstsht = Sheets("All Trades")
LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
srcsht.Range("A1:A" & LastrowA).EntireRow.Copy dstsht.Cells(LastrowB, 1)

However, I need the macro to only paste the values, not the formulas, data
etc.
Ordinarily, with a normal copy/paste macro, I would simply add:
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

But it does not let me.

Can someone assist me with this?

Thank you so much!

Kind regards,
Paul
 
Reply With Quote
 
 
 
 
Roger Govier
Guest
Posts: n/a
 
      31st Mar 2010
Hi Paul

srcsht.Range("A1:A" & LastrowA).EntireRow.Copy
dstsht.Cells(LastrowB, 1).Paste:=xlPasteValues


--
Regards
Roger Govier

PVANS wrote:
> Good morning
>
> I hope someone can help me with this. I am currently using the following
> code to copy the entire data from one sheet, and paste it below the previous
> data in a different sheet:
>
> Set srcsht = Sheets("Working")
> Set dstsht = Sheets("All Trades")
> LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
> LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
> srcsht.Range("A1:A" & LastrowA).EntireRow.Copy dstsht.Cells(LastrowB, 1)
>
> However, I need the macro to only paste the values, not the formulas, data
> etc.
> Ordinarily, with a normal copy/paste macro, I would simply add:
> Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
> :=False, Transpose:=False
>
> But it does not let me.
>
> Can someone assist me with this?
>
> Thank you so much!
>
> Kind regards,
> Paul

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      31st Mar 2010
Hi,

try it like this

Set srcsht = Sheets("Working")
Set dstsht = Sheets("All Trades")
LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
srcsht.Range("A1:A" & LastrowA).EntireRow.Copy
dstsht.Cells(LastrowB, 1).PasteSpecial
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"PVANS" wrote:

> Good morning
>
> I hope someone can help me with this. I am currently using the following
> code to copy the entire data from one sheet, and paste it below the previous
> data in a different sheet:
>
> Set srcsht = Sheets("Working")
> Set dstsht = Sheets("All Trades")
> LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
> LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
> srcsht.Range("A1:A" & LastrowA).EntireRow.Copy dstsht.Cells(LastrowB, 1)
>
> However, I need the macro to only paste the values, not the formulas, data
> etc.
> Ordinarily, with a normal copy/paste macro, I would simply add:
> Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
> :=False, Transpose:=False
>
> But it does not let me.
>
> Can someone assist me with this?
>
> Thank you so much!
>
> Kind regards,
> Paul

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      31st Mar 2010
oops,

I meant

Set srcsht = Sheets("Working")
Set dstsht = Sheets("All Trades")
LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
srcsht.Range("A1:A" & LastrowA).EntireRow.Copy
dstsht.Cells(LastrowB, 1).PasteSpecial Paste:=xlPasteValues
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"PVANS" wrote:

> Good morning
>
> I hope someone can help me with this. I am currently using the following
> code to copy the entire data from one sheet, and paste it below the previous
> data in a different sheet:
>
> Set srcsht = Sheets("Working")
> Set dstsht = Sheets("All Trades")
> LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
> LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
> srcsht.Range("A1:A" & LastrowA).EntireRow.Copy dstsht.Cells(LastrowB, 1)
>
> However, I need the macro to only paste the values, not the formulas, data
> etc.
> Ordinarily, with a normal copy/paste macro, I would simply add:
> Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
> :=False, Transpose:=False
>
> But it does not let me.
>
> Can someone assist me with this?
>
> Thank you so much!
>
> Kind regards,
> Paul

 
Reply With Quote
 
john
Guest
Posts: n/a
 
      31st Mar 2010
Mike,
you also omitted to add Application.CutCopymode = False to remove the
"marching ants"
--
jb


"Mike H" wrote:

> oops,
>
> I meant
>
> Set srcsht = Sheets("Working")
> Set dstsht = Sheets("All Trades")
> LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
> LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
> srcsht.Range("A1:A" & LastrowA).EntireRow.Copy
> dstsht.Cells(LastrowB, 1).PasteSpecial Paste:=xlPasteValues
> --
> Mike
>
> When competing hypotheses are otherwise equal, adopt the hypothesis that
> introduces the fewest assumptions while still sufficiently answering the
> question.
>
>
> "PVANS" wrote:
>
> > Good morning
> >
> > I hope someone can help me with this. I am currently using the following
> > code to copy the entire data from one sheet, and paste it below the previous
> > data in a different sheet:
> >
> > Set srcsht = Sheets("Working")
> > Set dstsht = Sheets("All Trades")
> > LastrowA = srcsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
> > LastrowB = dstsht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
> > srcsht.Range("A1:A" & LastrowA).EntireRow.Copy dstsht.Cells(LastrowB, 1)
> >
> > However, I need the macro to only paste the values, not the formulas, data
> > etc.
> > Ordinarily, with a normal copy/paste macro, I would simply add:
> > Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
> > :=False, Transpose:=False
> >
> > But it does not let me.
> >
> > Can someone assist me with this?
> >
> > Thank you so much!
> >
> > Kind regards,
> > Paul

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search for values in a sheet and copy found records one after theother in another sheet AndreasHermle Microsoft Excel Programming 12 17th Jun 2011 08:12 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Microsoft Excel Worksheet Functions 1 5th Oct 2005 01:04 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Microsoft Excel Misc 1 5th Oct 2005 12:18 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Microsoft Excel Discussion 1 5th Oct 2005 10:20 AM
how to find and copy values on sheet 2, based on a list on sheet 1 =?Utf-8?B?ZXZhbm1hY256?= Microsoft Excel Programming 4 7th Feb 2005 08:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:55 PM.