The following is an extract from a longer piece of code that transfers vehicles from one location to another. The section below handles a log which shows outstanding transfers. The sheet works on serial numbers. The code is designed to list new vehicle loans and remove them from the list once the vehicle is returned. What I am struggling with is skipping the code between the notes (code which adds vehicles to the list) when the initial instruction clears out vehicle details.
Please excuse the rough code. I have improved significantly, thanks to the help I have received from this forum, but sometimes my dodgy foundations let me down.
Thanks
Code:
Sub tester()
With Sheets("X")
Set F = .Columns("C").Find(What:=.Range("D448").Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not F Is Nothing Then F.EntireRow.ClearContents
End With
' need to add a goto here somewhere but only when it clears contents
With Sheets("X")
.Range("B448:G448").Copy
.Range("A445").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
.Range("A442:F445").Sort Key1:=Range("A442"), Order1:=xlAscending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
'need it to go here
Range("F438:F440").Select
Selection.Copy
Range("F442").Select
ActiveSheet.Paste
End Sub
Please excuse the rough code. I have improved significantly, thanks to the help I have received from this forum, but sometimes my dodgy foundations let me down.
Thanks