Update Code to Paste Special Values

JADownie

Active Member
Joined
Dec 11, 2007
Messages
395
This is driving me crazy today!!!

How do I edit my code below in red to add paste special values (trying to keep formatting and values). Everything I tried so far gets me an error

Sub Export()

Dim wsSummary As Worksheet, wbNew As Workbook, wsNewSummary As Worksheet, wsNewData As Worksheet
Dim loDD_Data As ListObject
Dim i As Integer, lngInsertRow As Long
Dim PvtTable As PivotTable, lngStartColumn As Long

Application.DisplayAlerts = False
Application.ScreenUpdating = False

'Source Summary Worksheet
Set wsSummary = ThisWorkbook.Worksheets("Summary")
'Source DD_Data table
Set loDD_Data = ThisWorkbook.Worksheets("AllData").ListObjects("DD_Data")

'Create a new workbook
Set wbNew = Workbooks.Add

'New Summary Worksheet
wbNew.Worksheets(1).Name = wsSummary.Name
Set wsNewSummary = wbNew.Worksheets(1)

'Delete any extra worksheets in the new workbook, if present
If wbNew.Worksheets.Count > 1 Then
For i = wbNew.Worksheets.Count To 2 Step -1
wbNew.Worksheets(i).Delete
Next
End If

'Copy the Job Summary Range
wsSummary.Range("rngJobSummary").Copy

'Paste to the new Summary worksheet
wsNewSummary.Cells(1, 1).PasteSpecial xlPasteAll

'Delete the data validation dropdown from cell B1 on the new summary worksheet
wsNewSummary.Cells(1, 2).Validation.Delete
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about
VBA Code:
With wsNewSummary.Cells(1, 1)
   .PasteSpecial xlPasteValues
   .PasteSpecial xlPasteFormats
End With
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,224
Members
453,025
Latest member
Hannah_Pham93

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