+ Reply to Thread
Results 1 to 2 of 2

Help with Do...Loop

  1. #1
    Noemi
    Guest

    Help with Do...Loop

    Hi
    I need a check to be done to see if column a has a number in it then to
    check if column b has a number.

    If column B doesn't have a number then I need it to stop and give a msgbox,

    When column A doesn't have data then I need the loop to stop as we dont have
    to check column b

    The code below is what I have but when I try to run it it keeps saying LOOP
    WITHOUT DO.

    I hope someone can help me as I am not very good with loops.

    mykeycode = Range("B32")
    mysell = Range("N32")
    Do
    mykeycode = mykeycode + 1
    mysell = msell + 1
    If mynum.Value <> "" Then
    If mysell.Value = "" Then
    mysell.Select
    MsgBox "Enter the ADV Sell Price"
    Exit Do
    End If
    Loop Until mykeycode.value = ""


    Thanks
    Noemi

  2. #2
    bpeltzer
    Guest

    RE: Help with Do...Loop

    I'm not sure I completely understand, as your text says you need to test
    columns A and B, but the code checks B and N. But the code won't run as is
    because you have two 'If then' constructs and only one 'End if'. Where
    you've got the 'End if', add another line just like it to close off the
    second conditional test.

    "Noemi" wrote:

    > Hi
    > I need a check to be done to see if column a has a number in it then to
    > check if column b has a number.
    >
    > If column B doesn't have a number then I need it to stop and give a msgbox,
    >
    > When column A doesn't have data then I need the loop to stop as we dont have
    > to check column b
    >
    > The code below is what I have but when I try to run it it keeps saying LOOP
    > WITHOUT DO.
    >
    > I hope someone can help me as I am not very good with loops.
    >
    > mykeycode = Range("B32")
    > mysell = Range("N32")
    > Do
    > mykeycode = mykeycode + 1
    > mysell = msell + 1
    > If mynum.Value <> "" Then
    > If mysell.Value = "" Then
    > mysell.Select
    > MsgBox "Enter the ADV Sell Price"
    > Exit Do
    > End If
    > Loop Until mykeycode.value = ""
    >
    >
    > Thanks
    > Noemi


+ 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