problem with VBA code

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have the following code for copying a chart and pasting
it as a picture into newly created sheet.

The problem are two fold:
1) it seems to take a long time for it to be copied (like
5 seconds or so for each chart)

2) Nothing visible gets pasted?

Anyone knows what's going on here please?

Private Sub Cmd_AddShCopyChrts_Click()
Dim wsMySheet As Worksheet

Sheets("Charts").Select

ActiveSheet.Shapes("Chart 1").Select

Selection.Copy

Set wsMySheet = Worksheets.Add

wsMySheet.Select

ActiveSheet.PasteSpecial Format:="Picture (Enhanced
Metafile)", Link:=False _
, DisplayAsIcon:=False


End Sub
 
John,

Sorry. I pasted your code into a worksheet, created
a chart and it runs just dandy for me, so your
code seems ok. Maybe someone else has a clue??

Good luck
jeff
 
Any chance that it's a display problem?

Can you close (and save) the workbook and reopen to see if you can see the new
chart?

(Sometimes, just minimizing the worksheet window (or excel's application window)
and then resizing will show it, too--well, when I have trouble with shapes.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top