Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default compare two worksheets and return a corresponding column

Hi friends,

I have one sheet(say A)sheet with names of associates. These associates are
again listed in different sheets with the name of a project they are working
in shown in the adjacent column.

Names of associates are identically typed in sheet A and other sheets.

In the first sheet I would like to bring up the project they are working in
by searching different sheets.

Pl help.
Krishna



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default compare two worksheets and return a corresponding column

Try this code. The code will put project names in a worksheet called sub
Associates. column A contains the Associates names on all sheets. The
Project name is in Column B on all sheets except Associates.


sub getprojects()

for each sht in activeworkbook.sheets
if sht.name < "Associates" then
RowCount = 1
Do while sht.range("A" & RowCount) < ""
Associate = sht.range("A" & RowCount)
Project = sht.range("B" & RowCount)
With sheets("Associates")

set c = .Columns("A").Find(what:=Associate, _
lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("Cannot find Associate : " & Associate)
else
'Find LastCol
LastCol = .cells(c.row,Columns.Count).end(xltoleft).Column
.cells(c.row,LastCol + 1) = Project
end if
end with
RowCount = RowCount + 1
Loop
end if
next sht

end sub

"Sai Krishna" wrote:

Hi friends,

I have one sheet(say A)sheet with names of associates. These associates are
again listed in different sheets with the name of a project they are working
in shown in the adjacent column.

Names of associates are identically typed in sheet A and other sheets.

In the first sheet I would like to bring up the project they are working in
by searching different sheets.

Pl help.
Krishna



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default compare two worksheets and return a corresponding column

Hi,

this worked brilliantly!

Thanks a lot.
regards
krishna

"Joel" wrote:

Try this code. The code will put project names in a worksheet called sub
Associates. column A contains the Associates names on all sheets. The
Project name is in Column B on all sheets except Associates.


sub getprojects()

for each sht in activeworkbook.sheets
if sht.name < "Associates" then
RowCount = 1
Do while sht.range("A" & RowCount) < ""
Associate = sht.range("A" & RowCount)
Project = sht.range("B" & RowCount)
With sheets("Associates")

set c = .Columns("A").Find(what:=Associate, _
lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("Cannot find Associate : " & Associate)
else
'Find LastCol
LastCol = .cells(c.row,Columns.Count).end(xltoleft).Column
.cells(c.row,LastCol + 1) = Project
end if
end with
RowCount = RowCount + 1
Loop
end if
next sht

end sub

"Sai Krishna" wrote:

Hi friends,

I have one sheet(say A)sheet with names of associates. These associates are
again listed in different sheets with the name of a project they are working
in shown in the adjacent column.

Names of associates are identically typed in sheet A and other sheets.

In the first sheet I would like to bring up the project they are working in
by searching different sheets.

Pl help.
Krishna



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default compare two worksheets and return a corresponding column

This is similar two what I need to do. Where do i enter the code when I have
adapted it for my situation?
--
ken


"Joel" wrote:

Try this code. The code will put project names in a worksheet called sub
Associates. column A contains the Associates names on all sheets. The
Project name is in Column B on all sheets except Associates.


sub getprojects()

for each sht in activeworkbook.sheets
if sht.name < "Associates" then
RowCount = 1
Do while sht.range("A" & RowCount) < ""
Associate = sht.range("A" & RowCount)
Project = sht.range("B" & RowCount)
With sheets("Associates")

set c = .Columns("A").Find(what:=Associate, _
lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("Cannot find Associate : " & Associate)
else
'Find LastCol
LastCol = .cells(c.row,Columns.Count).end(xltoleft).Column
.cells(c.row,LastCol + 1) = Project
end if
end with
RowCount = RowCount + 1
Loop
end if
next sht

end sub

"Sai Krishna" wrote:

Hi friends,

I have one sheet(say A)sheet with names of associates. These associates are
again listed in different sheets with the name of a project they are working
in shown in the adjacent column.

Names of associates are identically typed in sheet A and other sheets.

In the first sheet I would like to bring up the project they are working in
by searching different sheets.

Pl help.
Krishna



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
Compare 2 Worksheets and return differences in a third. TheBigStig Excel Worksheet Functions 4 November 1st 07 09:06 AM
Compare and Return Value Joanne Excel Worksheet Functions 4 September 5th 07 03:56 PM
Compare Value in Cell 1 to a List, Return Value if Match otherwise Return Null Ben Excel Discussion (Misc queries) 2 March 15th 07 01:02 AM
compare data in the same column on separate worksheets john mcmichael Excel Worksheet Functions 1 October 7th 05 01:44 AM
How to compare 3 numbers and return value basic Excel Worksheet Functions 6 April 8th 05 05:15 AM


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