I am trying to get my code to check the number of lines through a cell value, and then repeatedly delete the row 'x' number of times.
My problem is that I use a unique identifier to find the row to start the deletion process, but once that row is deleted first the code is unable to locate what to delete anymore. How can I lock in the row once I have found it so that the code can delete 'x' number of times?
My code (cNum is set to the value of 1)
Once findvalue is set I think I need to change it to the row number permanently for the remainder of the for loop, but I am not sure how to accomplish this or if it would work that way.
My problem is that I use a unique identifier to find the row to start the deletion process, but once that row is deleted first the code is unable to locate what to delete anymore. How can I lock in the row once I have found it so that the code can delete 'x' number of times?
My code (cNum is set to the value of 1)
VBA Code:
Set findvalue = DataSH.Range("A:A").Find(What:=Me.IDnumber.Value, _
LookIn:=xlValues, LookAt:=xlWhole)
x = findvalue.Offset(0, 12).Value
'delete the entire row
For cNum = 1 To x
findvalue.EntireRow.Delete ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Next cNum
Once findvalue is set I think I need to change it to the row number permanently for the remainder of the for loop, but I am not sure how to accomplish this or if it would work that way.