ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste All Problem (https://www.excelbanter.com/excel-programming/350195-paste-all-problem.html)

[email protected]

Paste All Problem
 
Hi I want to paste all into an area.

The area is one cell called ResDownload.

I am using this code...

Application.Goto Reference:="ResDownload"
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

If i just have one cell copied it works ok.

If however i have lots of cells copied from another sheet then i want
it to paste them all.

However, i get the error..

Runtime Error 1004
PasteSpecial of Range class failed.

Is there anyway i can get this working?

Thanks in advance!


Norman Jones

Paste All Problem
 
Hi Simon,

Try:
'=============
Public Sub Tester()
Dim rng As Range

Set rng = Selection
rng.Copy Destination:=Range("ResDownload")
End Sub
'<<=============

---
Regards,
Norman


wrote in message
oups.com...
Hi I want to paste all into an area.

The area is one cell called ResDownload.

I am using this code...

Application.Goto Reference:="ResDownload"
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

If i just have one cell copied it works ok.

If however i have lots of cells copied from another sheet then i want
it to paste them all.

However, i get the error..

Runtime Error 1004
PasteSpecial of Range class failed.

Is there anyway i can get this working?

Thanks in advance!




[email protected]

Paste All Problem
 
Thats brilliant. I was using the macro recorder and it just didnt quite
work.

Many thanks for that!


[email protected]

Paste All Problem
 
Hi it doesnt throw up an error but that doesnt paste all either

Sorry

Any more ideas


[email protected]

Paste All Problem
 
Oh i can see how it works now.

Sorry i was using Tools Macro and running the macro and it was losing
the focus of the cells to copy.

What i would actually like to do is copy cells from another spreadsheet
just simply by using Ctrl+C and thengoing to the speadsheet i want to
paste all into and just click a button on the sheet.

Any ideas how i can just paste what is already stored in the clip
board?
Thankyou


[email protected]

Paste All Problem
 
I'm now using

Range("ResDownload").PasteSpecial xlPasteValues

This works great on its own... However, i want to be able to clear the
contents of of a number of cells with the range ResClear before i paste
the values

If i use

Application.Goto Reference:="ResClear"
Application.CutCopyMode = False
Selection.ClearContents
Range("ResDownload").PasteSpecial xlPasteValues

I get the same erro message again.

Could this be caus its lost what i am copying?
Any ideas?


Norman Jones

Paste All Problem
 
Hi Simon,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim destRng As Range

Set rng = Selection
Set destRng = Range("ResDownload")(1). _
Resize(rng.Rows.Count, rng.Columns.Count)

Range("ResDownload").ClearContents
rng.Copy
destRng.PasteSpecial xlPasteValues

End Sub
'<<=============

--
---
Regards,
Norman



wrote in message
oups.com...
I'm now using

Range("ResDownload").PasteSpecial xlPasteValues

This works great on its own... However, i want to be able to clear the
contents of of a number of cells with the range ResClear before i paste
the values

If i use

Application.Goto Reference:="ResClear"
Application.CutCopyMode = False
Selection.ClearContents
Range("ResDownload").PasteSpecial xlPasteValues

I get the same erro message again.

Could this be caus its lost what i am copying?
Any ideas?




[email protected]

Paste All Problem
 
No sorry that doesnt work either.

What im trying to do.

Is go to one Spreadsheet . Copy the values i want.

Then go to this spreadsheet and clear the content of ResClear and then
paste the already copied values into ResDownload

Note ResClear is a number of cells ResDownload is just the top left
cell of those cells.

The guy im trying to do this for said it used to work andnow it doesnt.

Cheers


Norman Jones

Paste All Problem
 
Hi Simon,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim destRng As Range

Set rng = Selection

Range("Resclear").ClearContents

Set destRng = Range("ResDownload"). _
Resize(rng.Rows.Count, rng.Columns.Count)

rng.Copy
destRng.PasteSpecial xlPasteValues

End Sub
'<<=============

---
Regards,
Norman



wrote in message
ups.com...
No sorry that doesnt work either.

What im trying to do.

Is go to one Spreadsheet . Copy the values i want.

Then go to this spreadsheet and clear the content of ResClear and then
paste the already copied values into ResDownload

Note ResClear is a number of cells ResDownload is just the top left
cell of those cells.

The guy im trying to do this for said it used to work andnow it doesnt.

Cheers





All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com