LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default Excel Dummy - Please Help!

Hopefully this is it Ed

Sub Test4Ed()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim iLastRow As Long
Dim iPos As Long
Dim i As Long

Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")

With sh1
iLastRow = .Cells(.Rows.Count, "D").End(xlUp).Row
For i = 1 To iLastRow
iPos = 0
On Error Resume Next
iPos = Application.Match(.Cells(i, "D").Value, _
sh2.Range("D:D"), 0)
On Error GoTo 0
If iPos 0 Then
sh2.Cells(iPos, "B").Resize(, 2).Copy .Cells(i, "B")
End If
Next i
End With

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ed" wrote in message
...
Hi Bob - Once again thanks for your help... However, when I run the macro

it
appears to do exactly what I want to do except it is also modifying the OU
column which should not be modified. Can you please assist?

Thanks!
Ed


"Bob Phillips" wrote:

An alternate

Sub Test4Ed()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim iLastRow As Long
Dim iPos As Long
Dim i As Long

Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")

With sh1
iLastRow = .Cells(.Rows.Count, "D").End(xlUp).Row
For i = 1 To iLastRow
iPos = 0
On Error Resume Next
iPos = Application.Match(.Cells(i, "D").Value, _
sh2.Range("D:D"), 0)
On Error GoTo 0
If iPos 0 Then
sh2.Cells(iPos, "A").Resize(, 3).Copy .Cells(i, "A")
End If
Next i
End With

End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ed" wrote in message
...
Can anyone tell me how to accomplish the following:

I have two worksheets with 4 columns (OU, Full Name, Display Name,
AccountName, ). The values in the "AccountName" columns are the same

in
both
worksheet, but the values in the other three are different. I need to

find
a
way to search the two worksheets and when the AccountName in both

worksheets
match, I would like to replace the "Full Name" and "Display Name"

values
in
Worksheet 1 with the values (Full Name and Display Name) from

Worksheet 2.

BTW - Yesterday two members were kind enough to assist me with this
yesterday but the logic I provided them was a bit wrong.

Thanks for your assistance!








 
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
"Group" function very slow with Excel 2003 :( ... While very quick with Excel2000 :O) Alain79 Excel Discussion (Misc queries) 4 June 14th 05 07:34 AM
Stop Excel Rounding Dates leinad512 Excel Discussion (Misc queries) 1 April 20th 05 04:19 PM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Excel error - Startup (and Acrobat PDFMaker) gxdata Setting up and Configuration of Excel 0 February 4th 05 03:44 AM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM


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