ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   paste special code (https://www.excelbanter.com/excel-programming/431424-paste-special-code.html)

NDBC

paste special code
 
i have copied a worksheet to a new worksheet with

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy
wbNew.Sheets("Sheet1").Range("A2")

I just realised the filed are now linked. how do I paste special so that
only the values get saved in the new worksheet.

I gather I have to use this

PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

but don't know where to incorporate it.


Thanks

Per Jessen[_2_]

paste special code
 
Hi

Try this:

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy

wbNew.Sheets("Sheet1").Range("A2").PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False

Regards,
Per

On 22 Jul., 08:33, NDBC wrote:
i have copied a worksheet to a new worksheet with

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy
wbNew.Sheets("Sheet1").Range("A2")

I just realised the filed are now linked. how do I paste special so that
only the values get saved in the new worksheet.

I gather I have to use this

PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
* * * * :=False, Transpose:=False

but don't know where to incorporate it.

Thanks



Jacob Skaria

paste special code
 
Try the below which is equivalent to PasteSpecial

Dim arrData as Variant
arrData = wb.Sheets("A Lap").Range("a1" , Cells(ARow, MaxA))
wbNew.Sheets("Sheet1").Range("A2").Resize(UBound(a rrData, 1), _
UBound(arrData, 2)) = arrData

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

i have copied a worksheet to a new worksheet with

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy
wbNew.Sheets("Sheet1").Range("A2")

I just realised the filed are now linked. how do I paste special so that
only the values get saved in the new worksheet.

I gather I have to use this

PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

but don't know where to incorporate it.


Thanks


NDBC

paste special code
 
Thanks, worked a treat.


"Per Jessen" wrote:

Hi

Try this:

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy

wbNew.Sheets("Sheet1").Range("A2").PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False

Regards,
Per

On 22 Jul., 08:33, NDBC wrote:
i have copied a worksheet to a new worksheet with

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy
wbNew.Sheets("Sheet1").Range("A2")

I just realised the filed are now linked. how do I paste special so that
only the values get saved in the new worksheet.

I gather I have to use this

PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

but don't know where to incorporate it.

Thanks




NDBC

paste special code
 
Thanks jacob. One problem I am facing with paste special is I am loosing font
size and formatting for headings. does this method get around that and keep
formatting.



"Jacob Skaria" wrote:

Try the below which is equivalent to PasteSpecial

Dim arrData as Variant
arrData = wb.Sheets("A Lap").Range("a1" , Cells(ARow, MaxA))
wbNew.Sheets("Sheet1").Range("A2").Resize(UBound(a rrData, 1), _
UBound(arrData, 2)) = arrData

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

i have copied a worksheet to a new worksheet with

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy
wbNew.Sheets("Sheet1").Range("A2")

I just realised the filed are now linked. how do I paste special so that
only the values get saved in the new worksheet.

I gather I have to use this

PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

but don't know where to incorporate it.


Thanks


Jacob Skaria

paste special code
 
Try the below..Repeat the paste special with formats

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy

wbNew.Sheets("Sheet1").Range("A2").PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

wbNew.Sheets("Sheet1").Range("A2").PasteSpecial _
Paste:=xlPasteFormats Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False



--
If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

Thanks jacob. One problem I am facing with paste special is I am loosing font
size and formatting for headings. does this method get around that and keep
formatting.



"Jacob Skaria" wrote:

Try the below which is equivalent to PasteSpecial

Dim arrData as Variant
arrData = wb.Sheets("A Lap").Range("a1" , Cells(ARow, MaxA))
wbNew.Sheets("Sheet1").Range("A2").Resize(UBound(a rrData, 1), _
UBound(arrData, 2)) = arrData

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

i have copied a worksheet to a new worksheet with

wb.Sheets("A Lap").Range("a1:" & Cells(ARow, MaxA).Address).Copy
wbNew.Sheets("Sheet1").Range("A2")

I just realised the filed are now linked. how do I paste special so that
only the values get saved in the new worksheet.

I gather I have to use this

PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

but don't know where to incorporate it.


Thanks



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

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