+ Reply to Thread
Results 1 to 9 of 9

LOOP formula breaking

  1. #1
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    LOOP formula breaking

    Hi all, my loop formula keeps breaking, could anyone help see where am I going wrong here?

    1) Issue 1: For (ChooseVal = 1) I want this to return value if the cell is blank..but it keeps breaking

    2) Issue 2:
    I want this loop to only fill in my blank cells and skips any non blank cells.




    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: LOOP formula breaking

    I suspect this:

    Please Login or Register  to view this content.

    needs to be:

    Please Login or Register  to view this content.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Re: LOOP formula breaking

    no go..... the formula breaks on: If Val(.Cells(RowLoop, 13).Value) = """" Then

    Run-time error '13' - Type mismatch

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: LOOP formula breaking

    Why have you got 4 x " (double quote)?


    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Re: LOOP formula breaking

    I thought I needed double quotes, I changed it back to just 2 but still breaks.. However if I do "0" then it works...but I want it to scan for blanks though not 0
    Last edited by donyc; 02-08-2012 at 04:00 PM.

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: LOOP formula breaking

    Remove the Val statement from the condition:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Re: LOOP formula breaking

    did the trick and now on to next error lol...I get Run-time error '1004' Unable to get the Choose property of the WorksheetFunction Class and highlgihts below part right befor it loops

    .Cells(RowLoop, 13).Value = WorksheetFunction.Choose(ChooseVal, "comment 1", "comment 2")

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: LOOP formula breaking

    Please post the code as it now exists in your workbook.

    Thanks

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: LOOP formula breaking

    It probably doesn't help that there's the possibility of ChooseVal equalling 0 - if you call CHOOSE with 0 as the first parameter it will generate an error.

    Maybe:

    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)

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