Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Problems 1

Status
Not open for further replies.

Harley78

Electrical
May 8, 2007
77
Maybe someone can help....

I have created a simple macro that copies a worksheet (in the same workbook)and inserts a new worksheet. However, the format is totally different. The copied worksheet is landscape, but when it copies and inserts, it changes the column(s) dims as well as portrait. Also paste what ever you filled out on the original worksheet. So I just need a few tips on how to eliminate the data after it is copied and how to fix the format problem I am having.

Macro for copying the worksheet:

Private Sub CommandButton1_Click()

' IF YOU REQUIRE ADDITIONAL PAGE OF "MMD"


Sheets.Add
Sheets("MMD").Select
Cells.Select
Selection.Copy
Sheets("Sheet30").Select
ActiveSheet.Paste

End Sub

Thanks a bunch
 
Replies continue below

Recommended for you

Oh, one more thing,,, this is all under a command button that I created!
 
Try this:
Code:
Private Sub CommandButton1_Click()

 ' IF YOU REQUIRE ADDITIONAL PAGE OF "MMD"
 

 Sheets.Add
 Sheets("MMD").Select
    Cells.Select
    Selection.Copy
    Sheets("Sheet30").Select
    ActiveSheet.Paste xlPasteAll
    Application.CutCopyMode = False
    
End Sub
 
Thanks for the reply and it seems not to like the ActiveSheet.Paste x1pasteAll input.

However, I did create a keyboard shortcut formatting and it seemed to work...

Again, many thanks
 
That's not x1pasteAll but xlpasteAll where xl is short for Excel.

Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor