Export Excel sheet to another Excel sheet.

ebeyert

Active Member
Joined
Sep 15, 2006
Messages
284
All,
I have the following macro, which export the active worksheet to a new worksheet (new excel workbook/sheet “book 1”) (without the formulas, but with the columns width, values and formats.
My only issue is that I also have a picture in the active worksheet which don’t be copied to the new worksheet.

Can someone assist me with this?


Current Marco:

Public Sub ExcelExport()

Application.GoTo Reference:="Print_Area"
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub


Thanks in Advantage,
Best regards
Ellerd
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi Ellerd,

How about:

Code:
Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste


Thanks for your reply. I added the "ActiveSheet.Paste" to my macro and now i see that the picture is also copied, but i get a runtime error '1004" with the following message: This operation requires the merged cells to be indetically sized."

Code:
Public Sub ExcelExport()        
    Application.GoTo Reference:="Print_Area"
    Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
End Sub
[/QUOTE]


If i use only your macro
Code:
Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste
[/QUOTE]


Then indeed the picture is copied but not the ColumnWidths into the new sheet..
 
Upvote 0
Hi Ellerd,

If there is nothing else on your export sheet- you could try this:


Code:
Cells.Copy 
    Workbooks.Add     
ActiveSheet.Paste
 
Upvote 0

Forum statistics

Threads
1,203,225
Messages
6,054,244
Members
444,713
Latest member
SAK

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