+ Reply to Thread
Results 1 to 6 of 6

Identifier under cursor is not recognised - why?

  1. #1
    Registered User
    Join Date
    08-27-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    4

    Identifier under cursor is not recognised - why?

    Hi

    I have applied the following in order to filter across multiple sheets. I added the Errorcatch in after a 400 error appeared. The error is now appearing as Compile error: Label not defined. Then if I click 'ok,' the top line is highlighted yellow, with an arrow pointing to it from the left. If I right click on the arrow, and click 'Definition,' there is the error 'Identifier under cursor is not recognised'

    This is the code I have entered. Can you please help with my error?

    Sub apply_autofilter_across_worksheets()
    On Error GoTo Errorcatch
    Dim p As Integer, q As Integer
    p = Worksheets.Count
    For q = 1 To p
    With Worksheets(q)
    .Range("J22").AutoFilter field:=1, Criteria1:=">0.001"
    End With
    Next q
    Exit Sub
    End Sub

    Much appreciated

    Jenny

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Identifier under cursor is not recognised - why?

    The error is because you don't have a label in the code named ErrorCatch.

    Using right click>Definition is used to find variables, subs, objects etc.

    It won't find labels or other parts of the code, try using it on With or For.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-27-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    4

    Re: Identifier under cursor is not recognised - why?

    I have never used code before yesterday and am just trying to teach myself in order to come up with a solution to a problem in work. So, unfortunately, I don't know what you mean! How would you retype the code?

    The original code without errorcatch was:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Identifier under cursor is not recognised - why?

    What error are you trying to deal with?

  5. #5
    Registered User
    Join Date
    08-27-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    4

    Re: Identifier under cursor is not recognised - why?

    Without the Errorcatch bit in, there is just an Error 400 that appears. I saw online somewhere that adding in the errorcatch bit might show what was wrong. So it is the case that I need to add the errorcatch bit in correctly (if so - how) or can you see an error in the above bit of coding without the errorcatch.

    Sorry if this is confusing - I'm not entirely sure what it should look like, so finding it difficult to know what's wrong!

    Thanks for your help

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Identifier under cursor is not recognised - why?

    Adding On Error is more likely to hide the error.

    Is there no message when you get the error? Do you know if it happens on a particular sheet?

    If you really want to use On Error you could do it like this, assuming the error is on the Autofilter line.
    Please Login or Register  to view this content.

+ 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. Identifier under cursor is not recognized error!!
    By Krisane in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-17-2014, 06:32 AM
  2. [SOLVED] Identifier under cursor is not recognized error
    By ahilty in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-08-2013, 04:40 PM
  3. Set active cursor in TextBox (blinking cursor)
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2009, 10:54 PM
  4. [SOLVED] why am I getting a 3 d cross cursor instead of a pointer cursor?
    By 3 d cross cursor - turn it off in forum Excel General
    Replies: 1
    Last Post: 04-11-2006, 07:38 PM
  5. Cursor disappears / Cursor verschwindet
    By Cevikel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2006, 12:10 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