ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   lookups in other worksheets.... (https://www.excelbanter.com/excel-programming/302625-lookups-other-worksheets.html)

Steve Lim[_2_]

lookups in other worksheets....
 
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..

Dave Peterson[_3_]

lookups in other worksheets....
 
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




Steve Lim wrote:

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..


--

Dave Peterson



All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com