View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Macro that change words in predefined numbers

If you want to use code:

Sub authorcd()
Dim lr As Long, rng As Range, sh As Worksheet
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 2).End(xlUp).Row
Set rng = sh.Range("B2:B" & lr)
For Each c In rng
Set cd = sh.Range("C2", sh.Cells(Rows.Count, 3) _
.End(xlUp)).Find(c.Value, LookIn:=xlValues)
If Not cd Is Nothing Then
c.Offset(, 2).Copy c.Offset(, 3)
End If
Next
End Sub


"andrei" wrote in message
...
Could not say better in subject but this is what i need :

In column A i have book titles , in column B i have their book authors ,
in
column C i have a lot of authors ( all authors in column B are to be found
in
column C ) and in column D i have for each author a code . Something like
that :


A1 : A Fiery Peace in a Cold War
A2 : The National Parks: America's Best Idea
A3 : Dancing in the Dark: A Cultural History of the Great Depression

B1 :Neil Sheehan
B2 :Dayton Duncan
B3 :Morris Dickstein

C1 : John Keegan
C2 : Morris Dickstein
C3 : Rick Bragg
C4: Neil Sheehan
C5: Dayton Duncan

D1 : 1
D2 : 2
D3 : 3
D4 : 4
D5 : 5

In column E i need the code which corespondes to the author of the book in
A
column . So , in A1 i have a book written by "Neil Sheehan" , so in E1 i
need the code "4" , because the author "Neil Sheehan" has this code

Can this be done ?