Quote Originally Posted by Mordred View Post
Hi Andy, I think it may be because your code doesn't know which sheet it is supposed to run this on. Try declaring the sheet name, it should be similar to the following but perhaps with a different sheet name:
Dim ws1 As Worksheet
    Set ws1 = Worksheets("Sheet1")
With the sheet declared, you can now specifically call the proper ranges like
Do Until ws1.Range("F" & fircount).Value = cmdPassNum.Value And ws1.Range("H" & fircount).Value = ""
fircount = fircount + 1
Loop
You should do that for all ranges, rows, columns, cells, and whatever else requires explicit sheet calls. Let me know how it goes.
Thanks for the suggestion, unfortunately however, I have exactly the same debug message.

Quote Originally Posted by Richard Buttrey View Post
Hi,
When it debugs what is the value of 'fircount' and cmdPassNum?

What do cells F & H on the fircount row show? Are these errors?

If this doesn't help you'll need to upload your workbook.
The value of 'fircount' is 1048577 and the value of cmdPassNum is 1.

The value in column F should be the same as the value in cmdPassNum and the value in column H should be blank.

Many thanks,

Andy