Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 74
  • Last Modified:

Copy paste as values

I had this question after viewing VBA to copy paste columns form one file to other.

In the VBA soultion have code as below how can i copy paste values to destination sheet

rData.Columns(8).Copy Destination:=oWb.Sheets(1).Cells(11, 13)
            rData.Columns(21).Copy Destination:=oWb.Sheets(1).Cells(11, 5)
            rData.Columns(14).Copy Destination:=oWb.Sheets(1).Cells(11, 4)
            rData.Columns(15).Copy Destination:=oWb.Sheets(1).Cells(11, 2)
            rData.Columns(19).Copy Destination:=oWb.Sheets(1).Cells(11, 3)
            rData.Columns(22).Copy Destination:=oWb.Sheets(1).Cells(11, 6)

Open in new window


I ahve tried

rData.Columns(22).Copy Destination:=oWb.Sheets(1).Cells(11, 6).PasteSpecial Paste:=xlPasteAll

and

rData.Columns(22).Copy Destination:=oWb.Sheets(1).Cells(11, 6).PasteSpecial(xlPasteValues)

Nothing sis work can you please help me out
0
Nirvana
Asked:
Nirvana
  • 2
  • 2
1 Solution
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Try it like this....
rData.Columns(22).Copy
oWb.Sheets(1).Cells(11, 6).PasteSpecial Paste:=xlPasteValues

Open in new window

0
 
NirvanaAuthor Commented:
not working sir

rData.Columns(19).Copy oWb.Sheets(1).Cells(11, 3).PasteSpecial Paste:=xlPasteValues
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Copy and PasteValues lines should be two different lines not one line.
It must be like below....
rData.Columns(19).Copy 
oWb.Sheets(1).Cells(11, 3).PasteSpecial Paste:=xlPasteValues

Open in new window

0
 
NirvanaAuthor Commented:
yes sir realised it have to be in two different lines. sorry for the delay in response. thanks again
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now