Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method 'Range' of object '_Global' failed 2

Status
Not open for further replies.

Ebes1099

Technical User
Jul 8, 2009
156
US
I'm getting an error that I can't seem to figure out. I'm trying to search for a value in column F and set my Range to that cell. Then assign a value to a nearby cell using the offest formula. But I keep getting this error and I can't figure out why. The first line of code finds the matching value, but it doesn't seem to set the variable partB_Rng to the actual cell that value is in. I have a line of code above, Dim partB_Rng as Range so it is definitely a Range object.

Code:
Set partB_Rng = Range("F:F").Find(matchKey, LookIn:=xlValues)
Range(partB_Rng).Offset(0, 6).Value = AV_In
 
What about this ?
Set partB_Rng = Range("F:F").Find(matchKey, LookIn:=xlValues)
partB_Rng.Offset(0, 6).Value = AV_In

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hi,

Problem could be noting found...
Code:
    Dim partB_Rng As Range, matchKey, AV_In
    
    Set partB_Rng = Range("F:F").Find(matchKey, LookIn:=xlValues)
    
    If Not partB_Rng Is Nothing Then
        Range(partB_Rng).Offset(0, 6).Value = AV_In
    End If

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
I think it was a combination of both answers. I changed the second line to be partB_rng.Offset instead of Range(parttB_rng).Offset.

But also, I was trying to match on something that wasn't in the list.

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top