+ Reply to Thread
Results 1 to 2 of 2

Macro run time error

  1. #1
    Forum Contributor
    Join Date
    03-24-2010
    Location
    North West UK
    MS-Off Ver
    2013
    Posts
    112

    Macro run time error

    Hi guys,

    I'm creating a basic macro to remove some columns from a series of information.

    The idea is to paste the complete sheet from the attached file (Sheet 2) and paste in into the "Paste..." tab in the other attached spreadsheet.

    By pressing ctrl+shift+t after pasting the macro will remove certain columns and leave the results behind. The columns to remain are:

    Drivername
    Department
    StartTime
    EndTime
    Duration

    The macro I've created will do that but after it's finished I'm getting a run time error. Can anyone suggest a way to improve or clean that macro up so I don't get this. The amount of entries differs each week so I can't use a predefined number of rows (should that info be needed).

    I'm leaving the company and passing this onto someone with very basic Excel knowledge so looking to keep this error free as possible.

    However, would there be a further improvement to create a button on another sheet in my workbook so if the person clicks this it would do all the formatting in the "Paste..." sheet in the workbook?

    Thanks,
    Lew
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro run time error

    Your run time error is caused by the last line, which is trying to select a range in a table that doesn't exist:
    Please Login or Register  to view this content.
    Delete the line I've highlighted in red, and it will run without error.

    You could simplify to:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ 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. Replies: 0
    Last Post: 10-20-2014, 05:33 PM
  2. [SOLVED] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  3. MACRO ERROR WITH EXCEL 2013 - Run-Time Error '-2147417848 (80010108)'
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2014, 11:07 AM
  4. [SOLVED] Simple Calendar pop up macro --> error Run-time error '424': Object required
    By am_hawk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 10:38 AM
  5. [SOLVED] Macro error - Run time error 1004 (App defined/Object Defined error)
    By jlax34 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2012, 03:02 PM
  6. Excel Macro Error - Run time error 1004 - Paste method of worksheet class failed
    By kvflynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 10:51 AM
  7. Run-time error '1004': Macro error, only when shared
    By Pergo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2011, 12:57 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