lookups in other worksheets....

  • Thread starter Thread starter Steve Lim
  • Start date Start date
S

Steve Lim

RE:lookups in other worksheets....

I have two worksheets. One with textures and one with models.
I want to know how many models a texture is used in.

So I have libraryfile, texturefile in the TEXTURES worksheet and
texture, modelfile in the MODELS worksheet.

I've been toying with find.row, but to see if it is really there. If
it's not, I'll get N/A..
 
One way:

Option Explicit
Sub testme()

Dim myOtherRng As Range
Dim myCell As Range
Dim res As Variant

With Worksheets("othersheet")
Set myOtherRng = .Range("a1:G" & .Cells(.Rows.Count, "A").End(xlUp).Row)
End With

With ActiveSheet
Set myCell = .Range("a3") 'some cell???
res = Application.VLookup(myCell.Value, myOtherRng, 3, 0)
If IsError(res) Then
'same as n/a
'what to do?
Else
myCell.Offset(0, 1).Value = res
End If
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top