LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find function in VBA ?


Sub Macro1()
'
Dim lngA As Long
Dim lngB As Long
Dim varFind
Dim strFirstAddress As String

Worksheets("blad1").Activate
For lngA = 1 To Worksheets("blad1").UsedRange.Rows.Count
lngB = 2
With Worksheets("blad2").UsedRange
Set varFind = .Find(Worksheets("blad1").Cells(lngA, 1).Value,
LookIn:=xlValues)
If Not varFind Is Nothing Then
strFirstAddress = varFind.Address
..Range(varFind.Address).Interior.ColorIndex = 36
Cells(lngA, lngB) = strFirstAddress
lngB = lngB + 1
Set varFind = .FindNext(varFind)
Do While Not varFind Is Nothing And varFind.Address <
strFirstAddress
..Range(varFind.Address).Interior.ColorIndex = 36
Cells(lngA, lngB) = varFind.Address
lngB = lngB + 1
Set varFind = .FindNext(varFind)
Loop
End If
End With
Next lngA
'
End Sub


--
H.A. de Wilde
------------------------------------------------------------------------
H.A. de Wilde's Profile: http://www.excelforum.com/member.php...o&userid=30679
View this thread: http://www.excelforum.com/showthread...hreadid=539087

 
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
Need to find a function. MikeCampbell Excel Worksheet Functions 2 January 29th 07 01:40 AM
Find Function Guy Lydig Excel Discussion (Misc queries) 2 May 19th 06 07:19 PM
FIND function? Sonya Excel Discussion (Misc queries) 3 October 22nd 05 04:53 AM
Help with the FIND function Ranger Excel Worksheet Functions 1 February 25th 05 03:24 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


All times are GMT +1. The time now is 09:54 AM.

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"