Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Looking up data in a large sheet

A formula would be the easiest way but if you need a macro try this:

Sub Test()
Dim i As Range, iEnd As Long, iRng As Range
Dim found1 As Variant, found2 As Variant

With Sheets(1)
iEnd = .Cells(Rows.Count, 1).End(xlUp).Row
Set iRng = .Range(.Cells(1, 1), .Cells(iEnd, 1))
End With

For Each i In iRng
Set found1 = Sheets(2).Range("A1:IV1").Find( _
i.Value, LookIn:=xlValues)
If found1 Is Nothing Then
i.Offset(0, 3) = "Not Found"
Else
With Sheets(2)
ActCol = Mid$(found1.Address, 2, 1) & ":" & _
Mid$(found1.Address, 2, 1)
End With

Set found2 = Sheets(2).Range(ActCol).Find( _
i.Offset(0, 1).Value, LookIn:=xlValues)

If found2 Is Nothing Then
i.Offset(0, 3) = "Not Found"
Else
i.Offset(0, 3) = "Found"
End If
End If
Next i

End Sub

--
Dan Oakes

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you copy formulas only across a large sheet, under data? Mark Excel Worksheet Functions 2 February 9th 09 04:49 PM
copy part of large WS to another sheet Aurise Excel Worksheet Functions 3 June 19th 07 04:59 PM
Sheet File To Large due to Pivot Tables? Allan P. London, CPA Excel Programming 1 October 5th 06 10:22 PM
large page number in cenetr of sheet Ollie Excel Worksheet Functions 5 August 11th 06 04:46 AM
Multi-Sheet Pivot Table Too Large Jack Excel Discussion (Misc queries) 2 March 23rd 06 03:49 PM


All times are GMT +1. The time now is 06:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"