+ Reply to Thread
Results 1 to 9 of 9

Works but Still Errors?

  1. #1
    Registered User
    Join Date
    03-15-2017
    Location
    United States
    MS-Off Ver
    2016
    Posts
    63

    Works but Still Errors?

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    At line
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I get the error message "Run-Time Error 13 Type Mismatch" but the entire code still executes normally.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Works but Still Errors?

    What is selected?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    03-15-2017
    Location
    United States
    MS-Off Ver
    2016
    Posts
    63

    Re: Works but Still Errors?

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Works but Still Errors?

    That 'Range("A0...") is a problem, for one. That's a zero, not the letter 'O'.

    I can't understand the logic of the code you posted. You ask the user to input a string value (Any string will do, it seems) you then add a sheet and name it 'Report' (Possibility that sheet may already exist if the procedure has been run previously - another possible error). You then loop with a check for
    Please Login or Register  to view this content.
    Selected will never be empty, it is always assigned a value (even if False if the user has canceled input earlier).

    IsEmpty is the wrong function to use here. It is used to check for blank cells or uninitialized variables...

    This is also a potential problem
    Please Login or Register  to view this content.
    You make absolutely no check that what is entered can be used to refer to a valid range. What if the user enters 'GHGHGHGHH'...? Perhaps you should use the Type = 8 parameter of the Inputbox to ensure the user enters a valid range?
    Last edited by cytop; 03-16-2017 at 03:43 AM.

  5. #5
    Registered User
    Join Date
    03-15-2017
    Location
    United States
    MS-Off Ver
    2016
    Posts
    63

    Re: Works but Still Errors?

    Sorry, I should have explained it. The input value is a letter for the column you want to select. That column and its adjacent column's value is then copied over to a newly created sheet.

  6. #6
    Registered User
    Join Date
    03-15-2017
    Location
    United States
    MS-Off Ver
    2016
    Posts
    63

    Re: Works but Still Errors?

    it also stops at 36 instead of 5000

  7. #7
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Works but Still Errors?

    And it seems the values from the 2 columns are concatenated into 1 cell on the destination sheet. Why not take the time to explain (forget code) the exact sequence of events - I'm sure that code you posted can be replaced with something a little more logical.

  8. #8
    Registered User
    Join Date
    03-15-2017
    Location
    United States
    MS-Off Ver
    2016
    Posts
    63

    Re: Works but Still Errors?

    I haven't used excel for years so I just jumped in and studied what I needed, but I've found a good use for excel now so I know ill learn as I go.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,302

    Re: Works but Still Errors?

    Don't know what s does but lets start from here.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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. VBA that works perfectly in one file errors out in a new file based off the original!
    By carthesis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2016, 07:24 AM
  2. [SOLVED] Worksheetfunction.lookup works sometimes and errors out other times..
    By adamstarr12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2015, 11:17 AM
  3. [SOLVED] Re-naming a sheet, works but with errors
    By Barttm888 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2015, 09:02 AM
  4. [SOLVED] Userform Login Errors - Works with One, but not the Other! *** CODING ERROR ***
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2014, 05:26 PM
  5. Data validation - works with TAB or ENTER, errors from a Mouse Click
    By Buzz83 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-15-2013, 08:38 AM
  6. Works when stepped-through, but errors when macro ran
    By johnhildreth@citynet.net in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2006, 09:50 PM
  7. Replies: 6
    Last Post: 09-13-2005, 07:06 AM

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