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: 27,285
Default Match and Copy to array

How does it work perfect if it doesn't do what you want?

What does this do that doesn't answer what you want to do.

As I recall, I provided code that does what you ask, but you chose to ignore
it. Perhaps you should look back at your original post and say why that
doesn't work.

--
Regards,
Tom Ogilvy





"Chris" wrote in message
om...
I have a question about som things.

Earlier i get this script, and it works fine.

Sub test()
Dim r As Range, txt, ws1 As Worksheet, ws2 As Worksheet
Dim LookUpCell As Range, x
Set ws1 = Sheets("FireWall Rules"): Set ws2 = Sheets("LDAP")
With ws2
For Each r In .Range("b1", .Range("b65536").End(xlUp))
If Not IsEmpty(r) Then
If InStr(r, ";") = 0 Then
Set LookUpCell = ws1.Range("a:a").Find(what:=r.Value,
lookat:=xlWhole)
If Not LookUpCell Is Nothing Then
LookUpCell.Offset(, 1) = r.Offset(, -1).Value
End If
Else
txt = Split(Replace(r, " ", ""), ";")
For Each x In txt
Set LookUpCell =
ws1.Range("a:a").Find(what:=x, lookat:=xlWhole)
If Not LookUpCell Is Nothing Then
LookUpCell.Offset(, 1) = r.Offset(,
-1).Value
End If
Next
End If
End If
Next
Set ws1 = Nothing: Set ws2 = Nothing: Erase txt
End With
End Sub

This script looks in Column A of sheet1 for a certain company name,
search for the same company name in column B of sheet2, and copy the
column A value of the same row to sheet1 Column B. It works perfect.

Here a little example of sheet 2

A B C D E

1 employee Company

2 Steve Sony

3 John Philips

4 Chris Sony

5 Steven Sony

6 Rutger Philips



As you can see there are more employees at one company (company names
are also represented in column A of sheet but without dupes). I want
the empleyees in array, cause these have to be matched with my third
sheet.... I don't know how to do this any suggestions?



 
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
MATCH() on a 2D array? Geoff Lambert Excel Discussion (Misc queries) 7 April 25th 23 03:48 AM
Match using array of column and row references to match with jkfin1 Excel Worksheet Functions 1 September 16th 08 04:39 PM
index match array function-returning only first match, need last. Julie Olsen Excel Worksheet Functions 3 December 29th 06 12:50 AM
Match as well as does not match array function Vikram Dhemare Excel Discussion (Misc queries) 7 April 25th 06 09:15 AM
Copy Array pointer rather than entire array R Avery Excel Programming 2 August 24th 04 08:28 PM


All times are GMT +1. The time now is 03:03 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"