Find value in sheet1, copy offset value, find offset value in sheet 2, paste text in offset cell

BAKELOVEMORE

New Member
Joined
Apr 2, 2024
Messages
13
Office Version
  1. 365
Platform
  1. 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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I think you have got this line round the wrong way:
VBA Code:
c.Offset(, -1).Value = lrv
try:
VBA Code:
lrv=c.Offset(, -1).Value
 
Upvote 0

Forum statistics

Threads
1,217,132
Messages
6,134,806
Members
449,890
Latest member
xpat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top