Excel Macro Code to add words to separate column

constantinet

New Member
Joined
Mar 9, 2017
Messages
16
I am looking for an excel macro code to do the following:

If the name "Jane Doe" is in column H then I need the name "John Doe" dropped into column I.


Thank you in advance for any help provided.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Where would Excel find John Doe to know that it should go into column I. Is it shown somewhere else in a relationship to Jane Doe? Give us some more details on worksheet/workbook layout and arrangement.
 
Upvote 0
Jane Doe is find in column H and name repeats multiple times in column H, if the name Jane Doe is found in column H then I would like to drop the name John Doe into column I. John Doe is currently not on worksheet.

Thanks,
Tara
 
Upvote 0
I suspect that there is more to this than a simple insertion of a name, but I will give you a simple code for this specific request. Keep in mind that this is specific to Jane Doe and will not work for any other names.

Code:
Sub JaneDoe
Dim i as long, lr as long
lr = range("A" & rows.count).end(xlup).row
For i = 1 to lr
If instr(Range("H" & i),"Jane Doe")>0 then
Range("I" & i)= "John Doe"
End if
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top