+ Reply to Thread
Results 1 to 3 of 3

Run-time error?

  1. #1
    CWillis
    Guest

    Run-time error?

    I have a command button that executes many different subs. It will not
    execute the following sub (written inside sheet13(summ)):

    Sub SummAddTextBoxHeaders()

    'TPTB
    Sheets("Summ").Activate
    ActiveSheet.Cells(56 + (TPTB.Height - 66) / 12, 1).Select
    With Selection
    .Value = "Tech & Proj. Data Project Engineer Summary:"
    .Font.Bold = True
    End With

    End Sub

    It gives the following error:

    Run-time error '-2147417848(80010108)':
    Method 'Run' of object '_Application' failed

    I can run it by stepping through it with no problems. The offending line
    when using the command button is:

    ActiveSheet.Cells(56 + (TPTB.Height - 66) / 12, 1).Select

    (If I comment this line and the ones below it, I have no problems.) I have
    tried placing the routine in other locations with no success. Any help would
    be greatly appreciated. Thank you.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Response

    Could it be that the division can give a non-integer answer?
    Martin

  3. #3
    Kevin B
    Guest

    RE: Run-time error?

    I'm not quite sure what you intent was, but I created a textbox, using the
    default name of "Rectangle 1", and assigned it to a Shape object varaible.

    The code ran fine, inserting your stated text value at row 53

    Here's the modified code:

    Dim TPTB As Shape

    Set TPTB = ActiveSheet.Shapes("Rectangle 1")

    ActiveSheet.Cells(56 + (TPTB.Height - 66) / 12, 1).Select
    With Selection
    .Value = "Tech & Proj. Data Project Engineer Summary:"
    .Font.Bold = True
    End With

    --
    Kevin Backmann


    "CWillis" wrote:

    > I have a command button that executes many different subs. It will not
    > execute the following sub (written inside sheet13(summ)):
    >
    > Sub SummAddTextBoxHeaders()
    >
    > 'TPTB
    > Sheets("Summ").Activate
    > ActiveSheet.Cells(56 + (TPTB.Height - 66) / 12, 1).Select
    > With Selection
    > .Value = "Tech & Proj. Data Project Engineer Summary:"
    > .Font.Bold = True
    > End With
    >
    > End Sub
    >
    > It gives the following error:
    >
    > Run-time error '-2147417848(80010108)':
    > Method 'Run' of object '_Application' failed
    >
    > I can run it by stepping through it with no problems. The offending line
    > when using the command button is:
    >
    > ActiveSheet.Cells(56 + (TPTB.Height - 66) / 12, 1).Select
    >
    > (If I comment this line and the ones below it, I have no problems.) I have
    > tried placing the routine in other locations with no success. Any help would
    > be greatly appreciated. Thank you.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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