I am having trouble with the code below. It seems to work fine when I first open the workbook and run, but then conks eventually and continues to give the Error 400 message immediatly after its run.
Code:Sub One() Dim row_count As Long Dim myshape As Shape Dim Pic As Object Application.ScreenUpdating = False For Each Pic In ActiveSheet.Pictures Pic.Delete Next Pic For row_count = 5 To 56 Set myshape = Nothing Select Case Worksheets("Dashboard").Cells(row_count, 13).Value Case 1: Set myshape = Worksheets("ICON").Shapes("Picture 5") Case 2: Set myshape = Worksheets("ICON").Shapes("Picture 6") Case 3: Set myshape = Worksheets("ICON").Shapes("Picture 7") End Select If Not myshape Is Nothing Then myshape.Copy Worksheets("Dashboard").Paste With Cells(row_count, 8) Selection.Top = .Top Selection.Left = .Left + (0.5 * .Width) - (0.5 * Selection.Width) End With End If Next For row_count = 5 To 56 Set myshape = Nothing Select Case Worksheets("Dashboard").Cells(row_count, 14).Value Case 1: Set myshape = Worksheets("ICON").Shapes("Picture 8") Case 2: Set myshape = Worksheets("ICON").Shapes("Picture 9") Case 3: Set myshape = Worksheets("ICON").Shapes("Picture 10") End Select If Not myshape Is Nothing Then myshape.Copy Worksheets("Dashboard").Paste With Cells(row_count, 9) Selection.Top = .Top Selection.Left = .Left + (0.5 * .Width) - (0.5 * Selection.Width) End With End If Next Application.ScreenUpdating = True End Sub
Last edited by dreicer_Jarr; 03-11-2010 at 09:17 PM.
______________________________________
"Vision without Execution is a Hallucination"
Edison
what does debug show?
hmm cancel that works ok on mine
Last edited by martindwilson; 03-11-2010 at 08:06 PM.
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
It doesn't show anything. I just get a red X and the Error 400 message.
______________________________________
"Vision without Execution is a Hallucination"
Edison
It works fine on your PC? What version of Excel do you have?
______________________________________
"Vision without Execution is a Hallucination"
Edison
When I move the code to a module I get the following debug:
Error '1004': Paste method of worksheet class failed
And the line Worksheets("Dashboard").Paste is in yellow. I don't know what would be the problem though...
Anything?
Last edited by dreicer_Jarr; 03-11-2010 at 08:24 PM.
______________________________________
"Vision without Execution is a Hallucination"
Edison
i suspect its this bit
you havent told it where to pasteCode:myshape.Copy Worksheets("Dashboard").Paste
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks