Hello, I use the code below to find a row that has a specific value (as given in "DeviceId")and then pass information to that row. It works fine because there is only one occurrence of that value in the worksheet in the workbooks that I have been using it in; But now I would like to tweak the code for new workbook. The problem is that this new workbook could have that value in DeviceID multiple times. However the column that is 3 columns to the right of this value will be blank only one time, and this would be the row where I would want to pass that information. So I am thinking that I could use this blank cell as way of finding that row. In other words, the value in DeviceId And the blank cell 3 columns to the right is the target row.
I inserted the syntax (And Found.Offset(0, 3).Value = "") to the code below in an attempt to get that blank cell into the code but I am getting an object required error so I have it improperly worded, or improperly used completely.
I am still learning all of this from you all, and I know I have so much more to learn. I am guessing that I cannot apply an offset to a variable, at least not the way I did it. Can you offer any input on the way I should be doing this? As always I really value all of the help I get from all of you.
I inserted the syntax (And Found.Offset(0, 3).Value = "") to the code below in an attempt to get that blank cell into the code but I am getting an object required error so I have it improperly worded, or improperly used completely.
I am still learning all of this from you all, and I know I have so much more to learn. I am guessing that I cannot apply an offset to a variable, at least not the way I did it. Can you offer any input on the way I should be doing this? As always I really value all of the help I get from all of you.
VBA Code:
Dim Found As Range
Set Found = Sheets("Repair Log").Range("A:A").Find(What:=Me.DeviceId.Value, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False) _
If Found And Found.Offset(0, 3).Value = "" Is Nothing Then
MsgBox "No match for " & Me.DeviceId.Value, , "No Match Found"
Else
Found.Offset(0, 2).Value = Me.RepairComments.Value
End If