ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to read and find a name? (https://www.excelbanter.com/excel-discussion-misc-queries/259596-how-read-find-name.html)

Tom

How to read and find a name?
 
Hi,

Column 1 Sheet1 carries a list of names:
David
Susan
Kathie
John
etc.

Column 1 Sheet2 carries another list:
Jack
Susan
Fred
David
Sam
etc.

How do you write a macro to read David in Sheet1 then goes to find it in
Sheet2?
Perform a task, then returns to Sheet1, comes down 1 row to read Susan and
goes back to Sheet2, to find Susan and performs the same task. Repeat the
process until it reads a blank name in Sheet1 and stops. Thank you for any
help.

TIA
Tom



Don Guillett[_2_]

How to read and find a name?
 
Simplest version. NO need to goto the other sheet

sub loopeach()
for each n in sheet1.range("a1:a21")
msgbox sheet2.find(n,columns(1).row
next n
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Hi,

Column 1 Sheet1 carries a list of names:
David
Susan
Kathie
John
etc.

Column 1 Sheet2 carries another list:
Jack
Susan
Fred
David
Sam
etc.

How do you write a macro to read David in Sheet1 then goes to find it in
Sheet2?
Perform a task, then returns to Sheet1, comes down 1 row to read Susan and
goes back to Sheet2, to find Susan and performs the same task. Repeat the
process until it reads a blank name in Sheet1 and stops. Thank you for any
help.

TIA
Tom



Tom

How to read and find a name?
 
Excel 2003 doesn't like the line:
msgbox sheet2.find(n,columns(1).row
It says, "Syntax Error"
Thanks Don.

Tom

"Don Guillett" wrote in message
...
Simplest version. NO need to goto the other sheet

sub loopeach()
for each n in sheet1.range("a1:a21")
msgbox sheet2.find(n,columns(1).row
next n
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Hi,

Column 1 Sheet1 carries a list of names:
David
Susan
Kathie
John
etc.

Column 1 Sheet2 carries another list:
Jack
Susan
Fred
David
Sam
etc.

How do you write a macro to read David in Sheet1 then goes to find it in
Sheet2?
Perform a task, then returns to Sheet1, comes down 1 row to read Susan
and goes back to Sheet2, to find Susan and performs the same task. Repeat
the process until it reads a blank name in Sheet1 and stops. Thank you
for any help.

TIA
Tom





Don Guillett[_2_]

How to read and find a name?
 
Haste make waste. Still TOO simple but you get the idea

Excel 2003 doesn't like the line:
msgbox sheet2.columns(1).find(n).row
It says, "Syntax Error"
Thanks Don.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Excel 2003 doesn't like the line:
msgbox sheet2.find(n,columns(1).row
It says, "Syntax Error"
Thanks Don.

Tom

"Don Guillett" wrote in message
...
Simplest version. NO need to goto the other sheet

sub loopeach()
for each n in sheet1.range("a1:a21")
msgbox sheet2.find(n,columns(1).row
next n
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Hi,

Column 1 Sheet1 carries a list of names:
David
Susan
Kathie
John
etc.

Column 1 Sheet2 carries another list:
Jack
Susan
Fred
David
Sam
etc.

How do you write a macro to read David in Sheet1 then goes to find it in
Sheet2?
Perform a task, then returns to Sheet1, comes down 1 row to read Susan
and goes back to Sheet2, to find Susan and performs the same task.
Repeat the process until it reads a blank name in Sheet1 and stops.
Thank you for any help.

TIA
Tom






Tom

How to read and find a name?
 
Can't it be done automatically without the use of a message box?
Sheet 1 holds the names of say 50 people whose weekly wages will go up by
7.5% recorded in Sheet 2 - the task to be performed. I then want to replace
the list in Sheet 1 with 250 other names whose wages will be going up by 5%
and so on.

"Don Guillett" wrote in message
...
Haste make waste. Still TOO simple but you get the idea

Excel 2003 doesn't like the line:
msgbox sheet2.columns(1).find(n).row
It says, "Syntax Error"
Thanks Don.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Excel 2003 doesn't like the line:
msgbox sheet2.find(n,columns(1).row
It says, "Syntax Error"
Thanks Don.

Tom

"Don Guillett" wrote in message
...
Simplest version. NO need to goto the other sheet

sub loopeach()
for each n in sheet1.range("a1:a21")
msgbox sheet2.find(n,columns(1).row
next n
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Hi,

Column 1 Sheet1 carries a list of names:
David
Susan
Kathie
John
etc.

Column 1 Sheet2 carries another list:
Jack
Susan
Fred
David
Sam
etc.

How do you write a macro to read David in Sheet1 then goes to find it
in Sheet2?
Perform a task, then returns to Sheet1, comes down 1 row to read Susan
and goes back to Sheet2, to find Susan and performs the same task.
Repeat the process until it reads a blank name in Sheet1 and stops.
Thank you for any help.

TIA
Tom








Don Guillett[_2_]

How to read and find a name?
 

The msgbox was just to show you how it works. You would replace that with
what you want to do.
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Can't it be done automatically without the use of a message box?
Sheet 1 holds the names of say 50 people whose weekly wages will go up by
7.5% recorded in Sheet 2 - the task to be performed. I then want to
replace the list in Sheet 1 with 250 other names whose wages will be going
up by 5% and so on.

"Don Guillett" wrote in message
...
Haste make waste. Still TOO simple but you get the idea

Excel 2003 doesn't like the line:
msgbox sheet2.columns(1).find(n).row
It says, "Syntax Error"
Thanks Don.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Excel 2003 doesn't like the line:
msgbox sheet2.find(n,columns(1).row
It says, "Syntax Error"
Thanks Don.

Tom

"Don Guillett" wrote in message
...
Simplest version. NO need to goto the other sheet

sub loopeach()
for each n in sheet1.range("a1:a21")
msgbox sheet2.find(n,columns(1).row
next n
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tom" wrote in message
...
Hi,

Column 1 Sheet1 carries a list of names:
David
Susan
Kathie
John
etc.

Column 1 Sheet2 carries another list:
Jack
Susan
Fred
David
Sam
etc.

How do you write a macro to read David in Sheet1 then goes to find it
in Sheet2?
Perform a task, then returns to Sheet1, comes down 1 row to read Susan
and goes back to Sheet2, to find Susan and performs the same task.
Repeat the process until it reads a blank name in Sheet1 and stops.
Thank you for any help.

TIA
Tom










All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com