+ Reply to Thread
Results 1 to 6 of 6

runtime error when running recorded macro

  1. #1
    Registered User
    Join Date
    08-22-2016
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    14

    runtime error when running recorded macro

    Hello,

    I recorded a macro, with the last step being dragging a chart to expand it. When running it I got the runtime error 2147024809 'the item with the specified name wasn't found'

    I did some digging and believe this is due to the naming of 'chart 1', but haven't been able to find a fix. Problem should be the 2 lines below:

    ActiveSheet.Shapes("Chart 1").ScaleWidth 2.6588541667, msoFalse, _
    msoScaleFromTopLeft
    ActiveSheet.Shapes("Chart 1").ScaleHeight 2.575, msoFalse, msoScaleFromTopLeft


    If anyone has any idea, please let me know.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: runtime error when running recorded macro

    So "publish" on the forum this macro, for inspection

  3. #3
    Registered User
    Join Date
    08-22-2016
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    14

    Re: runtime error when running recorded macro

    Sure, here it is.

    Sub help()
    '
    ' help Macro
    '

    '
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("C3").Select
    ActiveCell.FormulaR1C1 = "2"
    Range("C4").Select
    ActiveCell.FormulaR1C1 = "3"
    Range("C5").Select
    ActiveCell.FormulaR1C1 = "4"
    Range("C2:C5").Select
    Selection.AutoFill Destination:=Range("C2:C34"), Type:=xlFillDefault
    Range("C2:C34").Select
    Range("D6").Select
    ActiveCell.FormulaR1C1 = "=CORREL(R[-4]C[-2]:RC[-2],R[-4]C[-1]:RC[-1])"
    Range("D6").Select
    Selection.AutoFill Destination:=Range("D6:D34"), Type:=xlFillDefault
    Range("D6:D34").Select
    Range("F2").Select
    ActiveCell.FormulaR1C1 = "-1"
    Range("F3").Select
    ActiveCell.FormulaR1C1 = "-0.95"
    Range("F4").Select
    ActiveCell.FormulaR1C1 = "-0.9"
    Range("F2:F4").Select
    Selection.AutoFill Destination:=Range("F2:F43"), Type:=xlFillDefault
    Range("F2:F43").Select
    ActiveWindow.SmallScroll Down:=-69
    Application.Run "ATPVBAEN.XLAM!Histogram", ActiveSheet.Range("$D$6:$D$34") _
    , ActiveSheet.Range("$I$2"), ActiveSheet.Range("$F$2:$F$43"), False, False _
    , True, False
    ActiveSheet.Shapes("Chart 1").ScaleWidth 2.6588541667, msoFalse, _
    msoScaleFromTopLeft
    ActiveSheet.Shapes("Chart 1").ScaleHeight 2.575, msoFalse, msoScaleFromTopLeft
    End Sub

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: runtime error when running recorded macro

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: runtime error when running recorded macro

    There must be numerical data in the 'B' column before running the macro, e.g.:
    (without them, a histogram will not be created)
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-22-2016
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    14

    Re: runtime error when running recorded macro

    Quote Originally Posted by AlphaFrog View Post
    Try this...

    Please Login or Register  to view this content.
    Hi AlphaFrog, thank you very much. It worked. Rep added.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Runtime error '-2147212726 (80041020) when running vba macro
    By Su S in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2016, 07:40 PM
  2. Runtime error 438 when running windows build macro in excel MAC
    By JanJaapve in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2015, 08:28 AM
  3. Runtime Error 13 - Type Mismatch while running Macro
    By rrajnish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2013, 02:01 PM
  4. Continuously running a recorded macro-Please Help
    By Nik.Kaps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2012, 07:27 AM
  5. Replies: 1
    Last Post: 08-04-2009, 10:43 PM
  6. runtime error 6 overflow when running a macro
    By Kim in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2006, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1