BAKELOVEMORE
New Member
- Joined
- Apr 2, 2024
- Messages
- 13
- Office Version
- 365
- Platform
- Windows
I have looked at a lot of different ways to do this and tried to incorporate their ideas into this sub but I keep getting different errors every time I run it. I am searching for "0" in the listed ranges of the STATUS SHEET and finding the offset value which is the vehicle number. then finding that vehicle number on LRV ISSUES and pasting "OOS" one cell to the right. It seems to work once and then errors so I am thinking my looping is wrong. Thanks for any help.
VBA Code:
Sub FindOOS()
Dim c As Range
Dim d As Range
Dim firstAddressC As String
Dim firstAddressD As String
Dim lrv As String
With Worksheets("STATUS SHEET").Range("B5:B37,E5:E37,H5:H37,K5:K37,M5:M35")
Set c = .Find("0", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddressC = c.Address
Do
c.Offset(, -1).Value = lrv
Worksheets("LRV ISSUES").Range("A3:R32").Select
Set d = .Find(lrv, LookIn:=xlValues)
d.Offset(, 1).Activate
ActiveCell.Value = "OOS"
Worksheets("STATUS SHEET").Select
Set c = .FindNext(c)
Loop While Not c Is Nothing
End If
End With
End Sub