+ Reply to Thread
Results 1 to 3 of 3

IF then loop for each c with GoTo:, next c statement doesn't work

  1. #1
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    425

    IF then loop for each c with GoTo:, next c statement doesn't work

    Hi,

    I wrote a macro with a loop for each c in the usedrange. If c contains a certain string, i would like the macro to only exectute a part of the macro.
    For example, If c="check" the loop should Goto Check: and run another if then loop for each c. Somehow this loop is only run once, the "Next c" code is not executed.
    What am i doing wrong?

    Any help is much appreciated!

  2. #2
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    425

    Re: IF then loop for each c with GoTo:, next c statement doesn't work

    I misplace the Check: command. I fixed it by placing the "for each c" statement after the Check: statement.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF then loop for each c with GoTo:, next c statement doesn't work

    First, please show the actual code, rather than describe it. (Use code tags.)

    Second, using GoTo is not a good practice and I'm betting that is the source of the problem.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. If statement - unable to work out why it doesn't work
    By vba_newbie83 in forum Excel General
    Replies: 3
    Last Post: 11-25-2019, 09:26 AM
  2. On Error GoTo doesn't work when I use it multiple times in one code
    By stein7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2018, 10:11 PM
  3. help on a Do loop that doesn't work
    By g_liron in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2015, 10:50 AM
  4. UDF Doesn't work with top level Do While-Loop
    By indium in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2012, 01:17 PM
  5. Why doesn't this IF statement Work
    By maurices5000 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-27-2008, 01:38 PM
  6. My loop doesn't work why not
    By ljh66 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2007, 01:02 PM
  7. [SOLVED] For Each - loop doesn't work.
    By Intellihome in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2005, 07: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