I have a userform that users enter data into cells that are then sorted onto an Excel spreadsheet 'Main'.
If a user needs to delete an entry, they tab over till the offending entry is on the leftmost side of the userform and hit delete, an option box appears and asks them if they wish to delete 'yes' or 'no'. If they hit 'yes' the userform is supposed to clear the cells of the offending data while on the spreadsheet 'Main' it goes row by row and matches the value from the 'Auth1' to its counterpart somewhere in the 'A' column, deleting it.
Neither is happening. Putting in breaks, and stepping through the code and program, I have a Do While Loop that goes until it runs out of cells to check and then proceeds with the rest of the code.
It blew right passed the matching cell that no longer made the condition 'true'.
The code snippet in question:
Do While UMAuthorization!Auth1 <> ActiveCell
ActiveCell.Offset(1, 0).Activate
Loop
The 'Yes' sub in total
Private Sub DeleteYes_Click()
DeleteForm.Hide
CloseBook
OpenMinimized
Range("A2").Select
Sheets("Main").Unprotect
Do While UMAuthorization!Auth1 <> ActiveCell
ActiveCell.Offset(1, 0).Activate
Loop
ActiveCell.EntireRow.Delete Shift:=xlUp
Sheets("Main").Protect
SaveBook
Range("A2").Select
If Auth2 <> "" Then
Do While UMAuthorization!Auth2 <> ActiveCell
ActiveCell.Offset(1, 0).Activate
Loop
Else
Do While UMAuthorization!Claim1 > ActiveCell And ActiveCell <> ""
ActiveCell.Offset(1, 0).Activate
Loop
End If
End Sub
We just updated to 2016 excel. This code runs perfectly on 2010. To me, it makes total sense. However, Excel 2016 isn't acknowledging it. I've checked references and tinkered with values, but I'm stumped here. Thoughts anyone?
Edit: Here's some nonsensical sample data. Auth is column A. Row 1 is a static header.
1 Auth Claim TaxID Type AuthDate
2 0033087 154255 270275455 PT 08/25/18
3 0094525 155512 545465646 PT 12/12/18
4 0025125 555555 565445546 Acu 11/15/12
5 9994313 354585 564645545 X 01/08/18
6 5464654 111551 688558585 Chiro 09/15/09
7 9954545 445664 545665456 OT 05/30/15