+ Reply to Thread
Results 1 to 4 of 4

keep getting "debug error" [solved]

  1. #1
    Registered User
    Join Date
    11-18-2014
    Location
    australia
    MS-Off Ver
    2015
    Posts
    43

    keep getting "debug error" [solved]

    i have the following as a private code for a sheet. what it does is copy and paste tables from a hidden sheet, but only if the user chooses "yes". it works great, but even when i'm working on completely unrelated sheets, occasionally VBA will pop up the debug error. clicking "end" makes everything work fine again, until it pops up again. i'm hoping someone can help me figure out why i'm getting a debug error...i was thinking at first it might be related to worksheet_change but using _calculate or _selection stops the macro from working entirely.

    thanks. the "debug" error always shows up on the first If InStr...line. if i delete that line, it shows up on the second instance, and so on

    Please Login or Register  to view this content.
    Last edited by ferday; 02-11-2015 at 03:47 PM.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: keep getting "debug error" but everything still works. help with finding out why?

    It's probably because of your use of ActiveSheet. I'm guessing Not all of the sheets in your workbook have Range("VALUE1") etc., thus the error.

    Do you really want this code to be checking values on whatever sheet is active? If not, replace all your ActiveSheet's with the name of the Worksheet you want the code to be looking at. As example:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-18-2014
    Location
    australia
    MS-Off Ver
    2015
    Posts
    43

    Re: keep getting "debug error" but everything still works. help with finding out why?

    thank you so much! it was my bad, i assumed that the private code would only run when that sheet was active, so it seemed easiest to use activesheet...but i realized to use activesheet i should select.sheet first.

    your fix is working perfectly
    Last edited by ferday; 02-11-2015 at 03:23 PM.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: keep getting "debug error" but everything still works. help with finding out why?

    Great! Please mark this thread as SOLVED, and any reputation (the * in the lower left of my posts) is appreciated.

+ 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. Debug Error in Userform "Please Help"
    By bmoon171 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-15-2014, 02:19 PM
  2. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  3. Code "debug" error msg
    By cedarhill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2009, 05:26 PM
  4. Getting debug error when trying to do a "find"
    By KA_Analyst in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-24-2007, 10:58 AM
  5. Debug.Print "Test " vbCodeLineNumber & ": " & varName
    By TommySzalapski in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2005, 01:05 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